Jump to content
  • Advertisement
Sign in to follow this  
xXShadowAsasNXx

Quaternion or Matrix rotation for 3D Objects

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am working on a game engine, and I have a quaternion based camera class, but for general object rotation should i use quaternions or just use matrices with vectors?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Hi, I am working on a game engine, and I have a quaternion based camera class, but for general object rotation should i use quaternions or just use matrices with vectors?
Either one would be fine.

The main thing to keep in mind is that matrices and quaternions have the same fundamental behavior when it comes to rotations, so it's not like picking one or the other will determine in some way what your objects are able to do.

Each representation does have its advantages and disadvantages, though. Quaternions require less memory (which may or may not matter, depending on the context). Concatenating rotations in quaternion form can be more efficient than the equivalent matrix operation, and certain operations (notably interpolation) are more efficient and elegant with quaternions than with matrices.

However, if you use quaternions you'll almost certainly end up converting them to matrix form at some point (both for access to the corresponding direction vectors, and for interoperability with external APIs), which can offset some of the efficiency gains you might pick up elsewhere.

If I were starting an engine from scratch right now, I'd probably use quaternions as the base representation, and then extract direction vectors and/or convert to matrix form as necessary. Again, though, either would be fine - there's really no one 'right' choice.

Share this post


Link to post
Share on other sites
I would say stick to Matrices as I don't think there is any hardware support for quaternions.

If you are making a software engine then take your pick I suppose, they both seem to have advantages and disadvantages.

edit: ninja'd by a way better post :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!