# Swapping axes in skeletons & animations.

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

## 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 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 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 on other sites
Would just transforming the root bones work??

##### Share on other sites
Quote:
 Original post by raydogWould just transforming the root bones work??

good one. Yes, I think it would.

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
15
5. 5

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013644
×