Sign in to follow this  

Quaternion or Matrix rotation for 3D Objects

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?
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

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