What's the ":quat" at the end of the fromTo method for?

#1

So I’m interested in the “FromTo” method from iron.math.quat. In the Armory docs it just says:

fromTo (v1:Vec4, v2:Vec4):Quat

So, I get the first part setting the from and to vector4’s…but what’s that “:Quat” at the end do? What would a quaternion at the end actually be for? Is it to somehow set the rotation around the axis created by the fromTo method?

0 Likes

#2

In Haxe, a :Type at the end of an function signature means that the return value of that function is Type. The fromTo function will take a “from” (v1) and a “to” (v2) vector and return a Quat that represents a rotation pointing from v1 to v2.

3 Likes