When I add small torques to rotate a body, I noticed that the values for Euler angles are wrong as displayed. The values are correct when the body rotates after the torque is applied, but WHILE the torque is applied, the Euler angle CHANGES drastically, only to revert to correct value when torque is no longer applied and the body is rotating freely under inertia. To reproduce:
Insert the following into body's SetTransformCallback:
- Code: Select all
EulerXYZ = rotation.GetXYZ_EulerAngles();
where EulerXYZ is a global vector
and display it using
- Code: Select all
Print (dVector (1.0f, 1.0f, 1.0f, 1.0f), 10, 364, "Rotation: X = %5.8f", EulerXYZ[0]);
Print (dVector (1.0f, 1.0f, 1.0f, 1.0f), 10, 384, "Rotation: Y = %5.8f", EulerXYZ[1]);
Print (dVector (1.0f, 1.0f, 1.0f, 1.0f), 10, 404, "rotation: Z = %5.8f", EulerXYZ[2]);
With thihs setup, I have added torque to the body in X-axis and observed the correct Euler angle readout from zero to 3.14, then back from -3.14 to zero - which is the correct behavior. However, if I add more torque at around 90 degrees (1.57rad) while the body is already rotating under angular momentum, the readout of the Euler angle drops from 1.57rad to around 0.6rad. When I let go of the torque key, the readout jumps back to the correct current Euler angle. It is important to note that, while the readout of the value obtained using GetXYZ_EulerAngles() is incorrect, the body itself does NOT jump to the incorrect value - it continues to rotate properly and react to torque addition (aside from the issue with very small torques which are already in the bug list)
Cheers,
Misho