Quaternions with a camera

Recommended Posts

Hello, I am implementing a quaternion camera. First off, does anyone know a good site with a tutorial on quaternions or quaternion cameras other than NEHE and Gametutorials.com ? Ok, my question is, I have three quaternions as members of my class. They represent the pitch, yaw, and roll rotations. When I multiply them together, how do I know which order to do it in? Since the multiplication of quaternions isn't commutitive, then is there a way of knowing what the result will be and which order to do it in? Second, going off the tutorial on NEHE on quaternion cameras, the author creates a matrix out of the pitch rotation quaternion. He goes on to use the 9th entry for the y coordinate of the direction vector. He then multiplies the pitch and heading rotation quaternions and creates a matrix out of the result. He uses the 8th entry for the x coordinate of the direction vector and the 10th entry for the y coordinate. Could someone explain the math behind this? EDIT: Do you think I am allowed to post the code snippet from the NEHE camera tut to make things clearer if they aren't?

Share on other sites
Can anyone help me? Do I need to restate my question?

Share on other sites
I use one quat to represent the rotation of the camera, then apply rotations to that as and when they occur. This is usually done by creating a 'delta' quat from YawPitchRoll angles.

To render the frame, I construct a matrix from the updated rotation quat and apply it to the reference view vector.

Not sure if this is the best way, but it works for me.

Create an account

Register a new account

• Forum Statistics

• Total Topics
628365
• Total Posts
2982273

• 10
• 9
• 13
• 24
• 11