Game Development Community

Obj.setTransform(); --> rotTheta ???

by Thomas Bang · in Torque Game Engine · 04/03/2008 (1:19 am) · 1 replies

Hi

I want to rotate a object. But i dont understand the rotTheta-Value.
The World Editor Inspector shows me something like this:

Rotation: 0.170538 -0.355228 0.919092 167.142

Do i have to normalize the RotationVector first?

Example (as simple code):

Rotate the Object around the x-axis 90 degree.

VectorLength = mSqrt(90*90+0*0+0*0);

rotX = 90 / VectorLength;
rotY = 0 / VectorLength;
rotZ = 0 / VectorLength;

%obj.setTransform(0 0 0 rotX rotY rotZ VectorLength);


I know... instead of the above calculation i could use the VectorNormalize-Function.


Greetings


Thomas Bang
Germany

#1
04/03/2008 (4:37 am)
I'am so stupid. Problem solved.

In the book "Game Programmers Guide to Torque" i found these lines:

Rotation: Four floating-point values where the first three are multipliers and the fourth value is the angle (in degrees) of the rotation(s).
Example: rotation 0 1 0 90.0 means the object is rotated 90 degrees about the y-axis, relative to the world-axis.