Euler angles and 3D conventions

Started by
0 comments, last by Max_Payne 20 years, 6 months ago
For my 3D engine, I chose euler angles because they are easy to work with. Its easy to specify an euler angle for an entity and mentally visualize how its going to be placed in space, its also easy to change the pitch, the yaw or the roll by hand if you wish to make it rotate. I also chose to use a right handed axis convention where the Y axis is up, the X axis goes to the right, and the positive Z goes towards the viewer. I am wondering how to interface all this together. I have assumed the following: 1) Euler angles should be specified as (yaw, pitch roll) 2) Euler angles of (0,0,0) would mean that an object is facing the positive X direction (like a theta of 0 in 2D space). 3) The first rotation would be the yaw, around the Y axis, the second would be the pitch, around the new Z axis, and then the roll, around the new X axis. In OpenGL this works well as: glRotatef(Yaw , 0, 1, 0); glRotatef(Pitch, 0, 0, 1): glRotatef(Roll , 1, 0, 0); The problem I am having is how to actually get a rotation matrix out of this and also how to get a side and an up vector. I have been able to, by experimenting, get a direction vector out of euler angles. It was easy, because the direction vector is only affected by the yaw and the pitch... But, when it comes to getting a side or an up vector, those vectors are affected by all three angles... And even using successive rotation matrices, I have been totally unable to get a proper side or up vector... It plain doesn't work when all angles are set at 45 degrees. In theory: - The direction vector should be the transformed (1, 0, 0) - The up vector should be the transformed (0, 1, 0) - The side vector should be the transformed (0, 0, 1) [edited by - Max_Payne on September 23, 2003 2:31:57 PM]

Looking for a serious game project?
www.xgameproject.com
Advertisement
Apply the identity matrix, do the transformations, get the resulted matrix, and multiply each of those points by that matrix. Right?

This topic is closed to new replies.

Advertisement