Search code examples
pythonanimationrotationunity-game-enginemaya

Why are the animation rotation value in Maya different from that in Unity?


I have a FBX file with animation in it. When I import it into Maya(2017), the rotation value of bone 'arm_r_shoulder' looks like this:

maya Image

But the value just changed after importing it into Unity(5.6.1f1):

Unity Image

The fbx can be downloaded here.

My question is, why are those values different? And how should I handle that?


Solution

  • I suppose it's the Rotate Order and/or Order of Transformation issues. At first, check what Rotate Order in Maya and then in Unity. This parameter must be the same in both packages.

    enter image description here

    You can change the Rotate Order but preserve the overall transformation in Maya using this line of code:

    import maya.cmds as cmds
    cmds.xform(preserve=True, rotateOrder='yzx')
    

    Also, there's Euler rotation vs Quaternion Rotation scheme: enter image description here

    import maya.cmds as cmds
    cmds.rotationInterpolation('polyModel_rotateY', convert='quaternion')
    

    Read this post to know how to make conversions using Python: Quaternion to Euler Rotations.