Sunday, April 27, 2014

Rotation!

Continued from the previous entry.

Before digging into the Quaternion implementation, I first inspected the retail version of EMI again to verify its approach to applying the rotation angles.

In the scene 'mig', I moved Guybrush to the position (1,0,-7) so it was easy to see the result of rotation. Next, I set the rotation to (0,0,0), resulting in the following, which represents our origin pose:
The origin pose for all of the rotation tests
To make sure that nothing else is interfering, I'll set Guybrush back to this rotation before each operation. Next, I set Guybrush to 90 degrees for each of the rotation angles to determine the name for each principle axis:
Demonstrating the principle axes
  • guybrush:setrot(90,0,0) - Pitch (rotation in the Y-Axis)
  • guybrush:setrot(0,90,0) - Yaw (rotation in the Z-Axis)
  • guybrush:setrot(0,0,90) - Roll (rotation in the X-Axis)
We now know which axis is which in the setrot() method. Using this information, we'll determine what order the rotations are applied by combining the principle rotations:
Combined rotations on the principle axes
Which is produced by the following rotations:
  • guybrush:setrot(45,45,0)
  • guybrush:setrot(0,45,45)
  • guybrush:setrot(0,45,45)
  • guybrush:setrot(45,45,45)
From this, we can say that the setrot() method's arguments are definitely Pitch, Yaw, Roll, in that order. From the combined rotations, it appears that the rotations are applied in the order ZXY (by axis). With this information, I can ensure that the Quaternion implementation is using the correct rotation order.

No comments:

Post a Comment