Search code examples
maya

Maya SDK Conversion between Rotation Anim curve to Quaternion


so I have a specific question on the Maya SDK API, as documentation on this is quite poor.

So I have extracted at a particular key frame, the X, Y, and Z angle on the respect Rotation AnimCurves.

I am, however unsure how to properly convert this to a Quaternion, as the order of X, Y, and Z could be dependent on the person using Maya.

Thanks


Solution

  • Anyway after many hours of debugging I did a work around to fix the bug.

    It seems that a given animcurves of a bone does not necessarily give the bones local transform -- which is what I thought it did

    The XYZ angles it gave me back were its global rotation -- which really wrecked me.

    In order to extract the local quaternion, this seemed to work:

    Loop over all keyFrameTimes

    Use MAnimControl::setCurrentTime  to the keyTime
    
    localMatrix = jointPath.inclusiveMatrix() * jointPath.exclusiveMatrixInverse();
    
    from this matrix extract the Translation/Rotation/Scale out,
    and it seems to work fine
    

    End