How to know the orientation of an object?

Hi,

My game is a 3D-puzzle and i want to know when someone wins the game. In order to do this, i must know the orientation of all my cubes and compare it to final positions. Is someone has an idea?

Don’t you keep track of the orientation yourself? If you don’t, you should be. Not only for drawing everything correctly, but for using that information to see if someone won.

Hi,

The problem is that keeping orientation with angles isn’t working. In fact, making a rotation on x and then on y is not the same as making a rotation on y and then on x. So how to determine the real orientation?

Mantain orientation using model view matrix of OpenGL after a lof of rotations is confuse. Is better let fixed world coordinates system and yourself apply the transformation over the vertex of the mesh using a Rotation Matrix or anything else.