Sign in to follow this  
Slaru

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 this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this