Game Development Community

Transform bug?

by Howard Dortch · in Torque Game Engine · 08/21/2007 (3:59 pm) · 3 replies

I get the %player.getTransform() and echo word 6 which I assume is the rotation. All is well until I get to around 234 deg rotation then the values are wrong.
The rotation about the z is 0 0 1 to that point then it magicly switches to 0 0 -1 at about 234 is there any reason for this to happen ? Is it a bug?

#1
08/21/2007 (6:00 pm)
0 0 -1 234 is a valid rotation, the engine just chose to represent the quaternion that way.

the first three numbers define the axis, the fourth number is the rotation around it.
#2
08/22/2007 (6:05 am)
Yeah I get the format. Let me explain it again.

You (your player) stands facing +y rotation about the z is 0 0 1 2 so you are rotated about the z axis at 2 degrees.
Turn right, the numbers for the rotation about +z continue to increase you look south your rotation is now 0 0 1 180 ...with me?

Keep turning right to around 234 (which in my opinion is a really odd number to switch) the rotation will change to 0 0 -1 126

Yes by all means this is a valid number but why does it switch to z = -1 at that angle?
I would expect it to change at 180 if it was going to go from +1 about z to -1 about z
#3
08/22/2007 (8:22 am)
Gotcha. i think you may never really find an answer to the question "why" on this one.
in the engine, rotations are stored as 3x3 or 4x4 matrices, and converting from that to angle-axis form may produce some unexpected but valid representations.

check out the "Angle-Axis representation and quaternion representation" section of this page.