# Rotating quaternions

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

## Recommended Posts

I'm currently working on a math library for my engine and I wnted to know if there was a convenient way of rotating (yawing, pitching and rolling) a quaternion. The only rticles I've read so far deal mostly with constructing quaternions as well as some simple operations. Is multiplying the only way? I would use eulers or the axis-angle method (the testing bed for the class is an FPS cam) but I don't want to deal with the different matrix multiplications (translate, Y rotate, X rotate, Z rotate) for simplicity and speed.

##### Share on other sites
There are shortcuts for rotating a quaternion about one of its local axes - I have code for this which I'll post if you're interested. You can also write specialized functions for rotating a quaternion about a world axis. For arbitrary axis-angle rotation, just multiply by the appropriate quaternion.

I don't know if that answers your question or not, but please ask if you need clarification.

##### Share on other sites
yeah, that sounds like what I need: a few simple functions for rotating a quaternion around it's local axis as well as world axis (for Y and Z rotation in the FPS cam). I'll probably end up implementing a uility function for arbitrary axis rotations, but for now all I need is code fo the X, Y and Z axis

The code would be very much appreciated!

##### Share on other sites
p' = qpq^-1 where p = your original quaternion and q is the quaternion representing the access of rotation...

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 15
• 14
• 46
• 22
• 27
• ### Forum Statistics

• Total Topics
634047
• Total Posts
3015231
×