I need a function that given Yaw, Pitch, and Roll, can produce the Front (or Looking At), Right, and Up vectors in "world coordinates".
In my particular world space, starting from the origin (0,0,0), X is positive to the left, Z is positive going away from the viewer/origin, and Y is positive going up.
For for example, given... (angles in degrees)
yaw=0, pitch=0, roll=0, the expected output is:
- front = (0.0,0.0,1.0)
- right = (-1.0,0.0,0.0)
- up = (0.0,1.0,0.0)
yaw=90, pitch=0, roll=0, the expected output is:
- front = (1.0,0.0,0.0)
- right = (0,0,0.0,1.0)
- up = (0.0,1.0,0.0)
yaw=0, pitch=90, roll=0, the expected output is:
- front = (0.0,1.0,0.0)
- right = (-1.0,0.0,0.0)
- up = (0.0,0.0,-1.0)
yaw=0, pitch=0, roll=90, the expected output is:
- front = (0.0,0.0,1.0)
- right = (0.0,1.0,0.0)
- up = (1.0,0.0,0.0)
The language I'm working in is C++, and I will gladly use glm to solve this problem if that makes the most sense. If I can get there through quaternion's I'm fine with that solution as well, since I've found other tutorials that describe how to get a quaternion from euler angles.
See Question&Answers more detail:os