Quaternion problem

Started by
0 comments, last by Zakwayda 19 years, 5 months ago
I always used euler angles to represent rotations, as they are really easy to manage. Now I'm switching to quaternions, as they are much more powerful (smooth interpolation, no gimbal lock etc). The problem is, if I use quaternions to store the rotation of my entities, how can I, say, position a camera behind an entity? With euler angles, you just end up with some sin/cos math and you have it, but I have no idea on how to implement this with quaternions.. Is there an easy way to convert a quaternion back to euler angles? Or should I keep using euler angles, and use quaternions only where they are really needed (camera interpolation when looking at something)?
Advertisement
One possibility would be to set the camera up initially using a matrix and then convert the matrix to a quaternion. From there, it seems that you could keep the camera oriented correctly with relative rotations, using the quaternion directly (i.e. with slerp, RotationArc(), etc.).

This topic is closed to new replies.

Advertisement