[no bug]rotational around y axis appears broken for matrices

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
rabbit
Posts: 15
Joined: Wed Sep 02, 2009 12:39 pm
Location: Sydney, Australia

[no bug]rotational around y axis appears broken for matrices

Post by rabbit »

I believe I have found a bug in the matrix class. Using the following code causes the scene node to become stuck at 90° and 270° on the y axis. Rotations seems to work well around the x and z axes.

here is the code but I am using:

float t = pDevice->getTimer()->getTime ()/1000.0f;

matrix4 mat;

mat.setRotationDegrees( testSceneNode->getRotation() + vector3df(0,1,0) );

testSceneNode->setRotation( mat.getRotationDegrees() );

I have also found a similar bug when using the quaternion class.specifically issues with the toEuler function.
cheshirekow
Posts: 105
Joined: Mon Jul 27, 2009 4:06 pm
Location: Cambridge, MA

Post by cheshirekow »

The rotation api exposed for most nodes uses a parametrization known as euler angles. While euler angles are capable of describing any orientation, determining the euler angles from a particular orientation can be ambiguous. In other words, the mapping from euler angles to an orientation in space is many to one. This mathematical phenomenon leads to a problem known as gimbal lock at high "pitch" (rotation about the 'Y' for this particular set of euler angles). See Fuzzy's link for more information about that.

If you want to operate at arbitrary angles and the standard rotation API for most nodes is not sufficient, put a DummyTransformationSceneNode as the parent of the node you're trying to rotate, and you can set it's orientation directly using the transformation matrix.
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

or use core::quaternions . The article explains this too
Post Reply