Jump to content
• ### What is your GameDev Story?

• Advertisement

Public Group

# Maya Rotations

This topic is 1220 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

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 this post

##### Share on other sites
Advertisement

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 this post

##### 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.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement
• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• ### Popular Now

• 10
• 11
• 13
• 9
• 11
• Advertisement
• ### Forum Statistics

• Total Topics
634088
• Total Posts
3015447
×

## Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!