• 9
• 10
• 9
• 10
• 10

# Maya Rotations

This topic is 946 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 using Maya and its right handed coordinate system to export some models to DirectX.

To display my mesh correctly (in DirectX left coordinate system)I negated the Z component on the vertex buffer and 1.0f-uv component. For the translation matrix I also negated the Z component and the objects are displayed correctly mapped and placed on the world. The problem is when I try to convert the rotations to left hand coordinate. With a function from Maya I get every rotation on its axis. For example object1 has rotationX=0, rotationY=0.8 and rotationZ = 0;

I compute those radians with XMMatrixRotationX/Y/Z but I dont know what to change to made them for left hand coordinate.

Edited by Azzazelus

##### Share on other sites

Don't just negate the Z, apply a left handed conversion matrix at the top of the hierarchy.  You can keep the rotations from Maya as they are.

float4x4 leftHandedConversion(
float4(1, 0, 0, 0),
float4(0, 1, 0, 0),
float4(0, 0, -1, 0),
float4(0, 0, 0, 1));

Edited by Doug Rogers

##### Share on other sites
Ok, so you can't do this with eulers.

Convert each transform into a world space matrix (for each key frame).

Create a scale matrix with -1 in z.

Pre AND post multiply each world space matrix by your scale matrix.

The matrices are now correct.

You'll now need to transform each matrix by the inverse of its parent.

From there you should have a local space matrix, which can be decomposed into a local space rotation (as a quat), local space scale, and local space translate. Euler angles will fuck up terribly, use quats.

If you make heavy use of scale and rotate pivots, this approach might start to fall apart for you.

If you have no scale in your transforms, then you can get away with negating the z translation, and X and y values of all quats (once they have been computed in world space). This will work, but its not great. You always end up doing mental gymnastics to convert between game and model coordinate systems.

To be honest though, if maya is your only DCC package, you only need to reverse the polygon winding (cull front faces, not back), and set a right handed projection matrix. And then, you are in a right handed world.