#### Archived

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

# Euler angles and 3D conventions

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

## 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 on other sites
Apply the identity matrix, do the transformations, get the resulted matrix, and multiply each of those points by that matrix. Right?

1. 1
2. 2
Rutin
21
3. 3
A4L
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633741
• Total Posts
3013624
×