views:

33

answers:

2

Ok, so here is what I have:

-an abstract "Object" class which I made in a framework to use it as a base class for all 3D objects.

-a Matrix4 member of this class which has the sole purpose of storing rotation info for the object.

-some functions that multiply the matrix: for each of the yaw, pitch & roll rotations (both global and local), I made a method that multiplies the above rotation matrix with a new matrix.

e.g.: if you locally yaw the object by 45 degrees in CCW direction, then rotMatrix = newRotationZMatrix(45) * rotMatrix;

What I would like to know is what is the best way of getting the global rotation of the object as a vector - generally speaking, how do you get the rotation angles around X,Y and Z from a transformation matrix that contains JUST rotations.

+1  A: 

There are techniques to obtain that, just get the euler angles from a rotation matrix, it involves a bit of math. Here you can read about it.

Matias Valdenegro
Thanks! It seems that's what I needed and curious enough, it's very close to what I thought the answer should be. I will look into it.
cantrem