Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Maya Animation Breaks after Importing in Unity

Discussion in 'Animation' started by amolwagh, Apr 6, 2014.

  1. amolwagh


    Apr 6, 2014

    I am trying to import a simple Maya animation file, that is a sample we are trying to import in Unity. (The actual game cycles are different and heavier.)

    The rig we have used is done with AB Autorigger and the animation is not referenced in the Maya File.

    I have imported the .ma file directly into Unity4, which I think should bake and take care of the FBX thing. (Please clarify about this as well)

    While importing we have set the rig to - > Legacy
    Also, selected the Bake animation in Unity 4.

    So following are the screencast of how it looks in maya, and unity.

    This is the screencast of how it looks in Maya -

    And this one is how it is in Unity game viewport. -


    As you can see, the model loses its smoothness. And the uncombined meshes, separates. And only the separated leg mesh is animated in my scene.

    The model we have used is not a single mesh. neither we have combined it, so, please give your inputs about
    this as well.

    Any response is appreciated.
  2. foxter888


    May 3, 2010
    for one you should use fbx, currently the versions of fbx that had worked for me where 2011 and 2012, now from the looks of it it doesn't seem that those meshes are skinned at all to any of the bones to unity just separates them, unless you where planning not to skin them it seems that you are missing to parent them inside maya
  3. TheCCJ


    May 2, 2013
    A few things:

    First, you shouldn't have to export to FBX, but should be able to load the Maya file in. However, if you choose to do this, make sure your FBX exporter in Maya is set to use FBX 2012 (or 2011). Otherwise, if you're using a newer version of Maya, it may be defaulting to FBX 2013/2014 when it does the export behind the scenes. (I personally like to just export to FBX myself, but it's not a necessity.

    Next, Whichever you decide to do, bake to the skeleton yourself in Maya, delete the various handles/effectors, and save the baked version out as a separate version (I usually use 'filename'_Baked.mb, or something similar), and use this for you import/export version. This just verifies the baking is done yourself, and you can also check it for gimbal issues before importing into Unity. I've run into too many problems using an auto-bake to let it go. Maybe I'm paranoid, maybe not, but I *know* this works, so I do it. :) (It also has the added bonus of letting you get rid of all the extraneous nodes an autorigger will add in, so less emmory used, less clutter, etc)

    Next: combine your meshes. Depending on how many separate meshes make up a character, you'll get that many duplicates of the skeleton being calculated. (Example: a character comprised of a torso, legs, head, and two swords (one for each hand), will actually be caluclated at runtime Five times, because each individual mesh bit is considered as a separate character, on the full skeleton. This adds up to huge performance hit as soon as you get a few characters like this in a scene. Also, the character splitting up like it is in Unity may very well be due to the various parts having their origins in different places, so the system scatters them about it while putting the origins at 0.0.0 (This is a total educated guess at this point... I don;t know for sure this is happening, but I've seen it before in other engines/projects). This way you'll at least know the character is properly centered, so that variable is thrown out.

    Is there a particular reason you're using legacy vs Mecanim?

    As far as the animation itself (and model smoothness)... I'm not sure offhand -- could be alleviated by fixes above (especially if animation isn't baking properly), or could have something to do with mismatched rigs, or any number of things. I would give the above a try first, and at least get as much of that under control as possible.
  4. amolwagh


    Apr 6, 2014
    Hey CCJ,

    Thanks for such an explanatory reply, really needed things in plain English and you have done it perfectly.

    Just can you please tell me the exact steps of baking things in Maya? Because We tried baking in 2011/12 version of FBX, but things get confusing and doesn't work out for us yet.

    Please if possible, give me steps to bake in your own words.

    And about Mecanim, we are not sure yet what works best as we are trying to import the animation cycles for the first time.
    Do you mean from next time, we should only use mecanim instead of any other rig setups?
    Let me know.

    Thanks in advance!
  5. TheCCJ


    May 2, 2013
    Second one first, Mecanim is a lot more user friendly, and allows you to use the blend tree system, IK (for humanoids), etc, so I think it would just prove to be a lot more painless. Also, I get the feeling that Legacy is going to get deprecated moving forwards,so you'd likely need to move over to it anyways. Just my own feelings.

    As far as baking in Maya goes....

    Got to Edit -> Keys -> Bake Simulation and hit the square button on the menu to bring up the options for this.

    The way I do it,

    I will have Heirarchy selected as 'Below'. This allows me to just pick the root node, and it will bake everything under the heirarchy (otherwise, you have to select every bone separately).

    'Channels' you can select either. I use 'From Channel Box' simply because I usually don't need to worry about keying things like scale and visibility, but this means I have to have the various things I do want baked (Translate and Rotate, usually) highlighted in the channel box. If you don't want to worry about making sure they're highlighted, just do 'All Keyable' -- it's more foolproof anyways.

    Time Range -- I usually have each sequence blocked out in my time slider, so I use that. Your choice.

    Bake To - Use 'Base Animation'

    Sample By - I leave it at 1.0, which means one key per frame.

    The rest are my own setup. You can experiment doing your own thing, these are just how I work.

    SmartBake: Off
    Keep Unbaked Keys: Off
    Sparse Curve Bake: Off
    Disable Implicit Control: On
    Unroll Rotation: On

    Once you Apply this (or bake, you can do either really), these will become your standard settings, so unless you want to change things, you can just click Bake Simulation and have this be your standard/default setup.

    Hope this helps.
  6. amolwagh


    Apr 6, 2014
    Hello CCJ,

    Thanks for your detailed help about baking and importing animation.

    The most of the problem was actually caused by the smoothness of the mesh, and we had accidentally constrained the smoothness.

    So as of now,
    1. Our animation are importing perfectly.
    2. The meshes are coming all together.

    But there are some problems about smoothness, And in case you have faced something like this let me know. Again thanks in advance.

    Here is how the animation looks as of now -

    (We can make this look smoother in Unity's Model setting but not through Maya.)


    First of all, the unity is not taking Maya's smooth mesh while importing. We tried setting Import Normals (in Model) to None. Not much of a difference.

    So due to this our left leg of the character becomes transparent when we move it across the viewport of unity.
    like this -

    The legs should actually look this much smooth (example from Maya) -


    Please let me know if you know what we can do to retain Maya's smoothness in this case.