Sign in to follow this  
Abominacion

Swapping axes in skeletons & animations.

Recommended Posts

Hello, I'm implementing an skeletal animation system, and in order to convert from my model's file coodinate system to my engine coordinate system I have to swap the y & z components of the vertices. However it isn't as simple as that for the bones (I'm defining the bone transform as a rotation stored in a quaternion, followed by a translation stored as a 3d vector), and I'm having a hard time wrapping my head around how to do the conversion between coordinate systems for them. So if any of you has faced this problem before & can shed some light in the subject I'd be grateful. Thanks.

Share this post


Link to post
Share on other sites
My advice is to google for the "matrix and quaternion FAQ", which used to be called the hexapod faq or something.

Use conversion to eulers to swap axes at load time, then back to quats for runtime.

There may well be a smarter way to do this using just quaternions, but I'm not 100% sure. Postmultiply your quaternion with another quat representing the rotation (90 degrees in the correct axis) into the 'correct' frame of reference.

Share this post


Link to post
Share on other sites
Something like this?


Q = Build quaternion that rotates -PI/2 radians around x-axis.

If joint is root in the hierarchy (origin):
Joint.Rotation = Q * Joint.Rotation
Joint.Position = Q * Joint.Position

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by raydog
Would just transforming the root bones work??


good one. Yes, I think it would.

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