Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Max_Payne

Euler angles and 3D conventions

This topic is 5476 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
Apply the identity matrix, do the transformations, get the resulted matrix, and multiply each of those points by that matrix. Right?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!