Game Development Community

How the function setTransform() works exactly?

by Nancy Lee · in Technical Issues · 08/17/2008 (12:40 am) · 3 replies

The first 3 parameters are easy to understand, but the last 4 are really confusing.
Could you explain how excatly how they work?

I have tries a few sets of parameters, like when I set the 4 rotation parameters as (0 1 1 45), the getTransform() give me back something like (... 0 0.776887 0.776887 1.14372), do you know whats the reason behind?

Thanks so much.

#1
08/17/2008 (2:11 am)
The last four parameters in the setTransform are Quaternions.

You could find more info here:

http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation

To simplify things, here is a dumbed down explanation. Try to visualize the 4th to 6th parameter is the axis, and the 7th as the amount of rotation around that axis.

The reason why the value changes is that the engine seems to normalize the axis and changes the values from angles back into radian. I might be wrong here, but that is what I assumed it to be :P
#2
08/17/2008 (7:34 am)
Just to be picky: the last 4 elements of a transform are an axis-angle form of attitude specification, not a quaternion. The two are pretty close forms but the numbers would be slightly different if it was a quaternion rather than an axis then the angle about that axis like Torque uses for setTransform. Pisals other comments are right on about how it is used in Torque.
#3
08/25/2008 (8:05 am)
In simple for any need to use this...
(0 1 1 45) not serve (X Y Z degree) use only 1 at the time etc to rotate in Z (0 0 1 degree)