Search Unity

How To: Getting Mixamo and Unity to work

Discussion in 'Animation' started by cloverme, Sep 24, 2018.

  1. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    116
    I'm writing this post because well, Animation in Unity is a nightmare for independent game developers. You found a great model, you try to use it and you have a mismatch between rigging and animations. Your character walks through walls, goes up, sinks down through the floor, etc. So, third party providers try to provide solutions by providing models that are rigged and animated. These are the best solutions, but often, the model isn't what you want or need, so you picking something else. Then you try to use Mixamo for some great looking animations, but you flail around in desperation as nothing works like you wanted it to.

    Likely, you've had the problem of the animation warping back to where you started and you search the internet only to discover that someone says "check root motion". You do, but that doesn't fix it, so you do what everyone else does and tinker away into oblivion until whatever good advice you get no longer works and you end up pulling your hair out. You see 10,000 posts about 'root motion', curves, each animation needing it's own avatar, and other spaghetti thrown at the wall of suggestions.

    (Hey, if anyone from Unity reads this: There's thousands of settings, checkboxes, dropdowns, and variables that you can set in Unity for animation and each one can throw off your animation. While the flexibility of Unity is awesome in this regard, most game developers want to drop a character into a scene and have it walk, run, or stand there without too much trouble. You need to do something to make rigging and physics with animation much, much easier. I'm sorry, but it's true).

    First, start a new project and a new scene to test your setup. I know, I know, you want to use your awesome scene that you build you drop your character in and see all the shaders in the awesome glory of your game. Sorry, spare yourself hours or days, it's just to test your character out, so new project, new scene.

    1) There's a T-pose pose in Mixamo, apply that pose first. If your model isn't recognized by Mixamo's auto-rigging, hire someone on upwork first to fix the model and put into a T-Pose. Great, download that and only that pose with the skin. If you don't have a T pose, give up now, it's a lost cause. Don't think, "well, it's close, I'll fudge it cause I try other stuff on the internet and I get close and it works". You need the T-pose.
    Pro Tip: If Mixamo doesn't recognize your FBX file, try an OBJ format instead.

    2) Import that *exact* FBX model you downloaded from mixamo into your project and add it to your scene. Not any other models you have, you need that exact model. Don't try the old switcharoo here, it won't work. The model should have the animator component added to it, if it doesn't add it manually. It will likely show up without materials applied, you can add them back later, just skip it for now. It must be the model you downloaded from Mixamo with the T-Pose avatar from Mixamo. You can't mix and match, it must be these two and nothing else.

    3) In your project window, click on the little arrow next to the model you added. You'll see an avatar down towards the bottom. Drag this avatar into the avatar slot on the animator component for the model in your scene. It might already be there, but if not, add it manually. If must be that exact avatar and that exact model. You can't get slick here either and try brute forcing a mix of models and avatars, it won't work.

    4) Click on "Select" on the model you imported. Click on "Rig". Change the dropdown to Humanoid. Click Apply. Wait, what? It worked... I know, you're expecting the errors right? You've been here before and it didn't work with the other model you were playing around with, I know, I know. If you followed the steps above, it worked without the yellow or red errors that ruined your prior weekend.

    5) In your Asset folder for the project where your model is stored, create an animation controller (right click, Create, Animation controller). Drag that controller to the open controller slot on your model.

    6) Go back to Mixamo. Your model should still be loaded there, now select the animation you want, like Walk. Download that animation. Use the import function in Unity to import that into the folder where your model is stored.

    7) Ah ah ah, don't add that animation yet. I know what you were thinking, it won't work. Okay, so click on the animation that you just imported into your project folder. In the inspector window, click on Rig, now change that from Generic to Humanoid and click apply. If you followed the steps correctly, no red or yellow errors here.

    8) In your model, double click on the animation controller you added earlier. Drag and drop the clip you just downloaded and set to humanoid into the animator.

    9) Click on your model that you added to your scene in the Hierarchy. Click Apply Root Motion, set update mode to Animate Physics.

    10) To add additional animations, follow steps 6 to 8.

    Optional depending on your project and animations:
    11) Add Rigidbody to your model, under constraints, for Rotation, check X and Z.
    12) Add a collider. Depending on your model, capsule or box collider may work best. Mesh causes a lot of additional problems, finish this step and you can tweak it later on.
    13) Add a couple of cubes to your scene to test, one for the floor and one for a wall.
    14) Place your model on top of the floor and in front of the wall.
    15) When you play your game, your character should not fall through the floor or walk through the wall.
    16) Go back and painfully add your materials to the model. You'll have to import them and then apply them. If you're lucky and placed your textures one folder above where your stored your model, they might auto-apply. If not, just put them back so your model looks complete again.

    If you've done everything above, your model won't fly into space, warp backwards during animation clips, sink through the floor, or just fail entirely. You can now copy the files into your real project and tweak from there for navigation meshes, etc.

    Good luck!
    -C
     
    Avisan, abj87, pjbaron and 10 others like this.
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,275
    What about sliding feet from mixamo animations?
     
    entropicjoey1 likes this.
  3. GuardHei

    GuardHei

    Joined:
    Feb 10, 2018
    Posts:
    72
    Seriously, I don't see a problem here. For my several attempts with Mixamo, I always follow this workflow automatically, because this is what you normally set up animators in Unity and it wants you to follow such a process. maybe they should develop some third-party converters or tools to make things easier. However, they are not necessary, I would say.
     
  4. Shwashbuckle

    Shwashbuckle

    Joined:
    Jun 8, 2015
    Posts:
    3
    Great article! Following this, got me to working animations. I've noticed a strange issue with how Unity sets up the Mixamo imported animation though. Animation plays correctly in Mixamo but once imported to Unity the animation plays but with what appears to be rig bones and joint twisted so that the arms look backwards and the feet on occasions cross over and clip each other. Any ideas on what might be causing this?
     
  5. badradionz

    badradionz

    Joined:
    Feb 2, 2018
    Posts:
    21
    Hey guys, when importing my own models that came from Adobe Fuse > Mixamo I get this weird texture issue please see photo...
     

    Attached Files:

  6. pyjamaslug

    pyjamaslug

    Joined:
    Jul 5, 2017
    Posts:
    46
    Go into each material and set it from transparent to opaque.
     
  7. pyjamaslug

    pyjamaslug

    Joined:
    Jul 5, 2017
    Posts:
    46
    I just followed the process outlined by @cloverme and there seems to be a step missing. Here is what worked for me; I am using unity 2018.2.20f and working with the passive_marker_man model from mixamo.


    - Download T-pose for the model you are working with.
    - Set the rig to humanoid and place the model in the hierarchy. There should be an animator component already added with the t-pose avatar referenced, if not, add it.
    - In the Animator component, apply root motion and set update mode to Animate Physics
    - Fix up the materials (different topic, you can do it later if you want)
    - Create an animator controller and add it to the animator component.
    - Go back to mixamo and apply a new animation to the model you are working with.
    - Download the FBX and import it into unity.
    - Change the rig to humanoid
    - On that Rig tab, change Avatar Definition to "Copy from other Avatar" then in the "Source" box that appears, reference the T-Pose avatar from the model you have loaded into the scene.
    - If you want it to loop time, set that in the animation tab
    - Drag the FBX containing the new animation into the animator controller.

    Everything should work.
     
  8. abrahammakko

    abrahammakko

    Joined:
    Aug 12, 2019
    Posts:
    2
    when you download the animation clips from mixamo separately, is it necessary to download with skins or without...
     
  9. tylerguitar75

    tylerguitar75

    Joined:
    Dec 12, 2011
    Posts:
    52
    What about adding mixamo animations to your own custom animations?
     
  10. Shadex

    Shadex

    Joined:
    Dec 18, 2013
    Posts:
    88
    Couple of things to add. First : https://docs.unity3d.com/Manual/RootMotion.html A reference

    When setting up the avatar, some models don't correctly set to T-Pose. If so, Click on Reset, then Enforce T Pose twice, and the T-Pose should be correct.

    Also since Maximo uses the same bones and everything, you can setup a single avatar, then use that as the source for all Maximo models.

    In the link above, there is a animation clip inspector. For root motion, root transform postion and rotation should be baked into pose, and usually set all 3 to "Original".

    Enable IK in the layer of the animator that uses the animation, and check Feet IK. If that doesn't work, go to Animation Clip Inspector, and set Root Transform Position Y to Feet instead of original.
     
  11. Checkpoint71

    Checkpoint71

    Joined:
    Jul 30, 2019
    Posts:
    6
    i did not understand how this works; if i do the ybot with rifle aim Animation the Animation in Mixamo looks good; in Unity there is Nothing Right; Feet, Head, Hands have different positions and look crazy....

    is it possible that anyone do a Video how to do it - that the mixamo Animation is exakt the Unity-Animation??
     
  12. antk

    antk

    Joined:
    Dec 10, 2013
    Posts:
    24
    this was super helpful, thank you!
     
    mohawkalex likes this.
  13. antk

    antk

    Joined:
    Dec 10, 2013
    Posts:
    24
    i'm new to mixamo - does the asset i download from mixmo come with a character controller? the character actually ran off camera. i was assuming it would run in place until i added a character controller, transitions, etc. thanks in advance!
     
  14. antk

    antk

    Joined:
    Dec 10, 2013
    Posts:
    24
    Found out that I had to check the "in place" checkbox when downloading from mixamo
     
    mysticvalleycsa likes this.
  15. Chapmania_Design

    Chapmania_Design

    Joined:
    Jan 27, 2017
    Posts:
    8
    Your article went straight to the Pool Room. Great work.
     
  16. rogodoy

    rogodoy

    Joined:
    Jan 24, 2013
    Posts:
    14
    The best solution is this tutorial.
     
  17. Sylance

    Sylance

    Joined:
    Jan 2, 2018
    Posts:
    3
    Very clear, thanks.
     
  18. hertz-rat

    hertz-rat

    Joined:
    Nov 3, 2019
    Posts:
    71
    I've never had problems working with animation before, but the mixamo ones keep resetting their transform every time they move forward a few feet. What's causing that?

    edit: fixed it. It had to do with baking or not baking some offsets, and a loop pose setting
     
    Last edited: Apr 16, 2020
  19. jumisko

    jumisko

    Joined:
    Feb 18, 2020
    Posts:
    8
    Great idea, but why is that greyed out for me? I cannot change the transparency problem. I finally got textures through blind exploration after watching about ten youtube videos, and now I can't just fix the transparency problem! ugh. Why so hard?!?!?

    I'm using 2019.3.9. I may try an earlier build to see if it works there. I can't be spending a whole day working on one model like this.
     
    Last edited: Apr 16, 2020
  20. dropframe

    dropframe

    Joined:
    Nov 18, 2019
    Posts:
    1
    You need to duplicate all of your materials out of the prefab and then set to opaque.
    Once you have done this you can drag and drop the materials onto each game object they should be on
     
    jumisko likes this.
  21. jumisko

    jumisko

    Joined:
    Feb 18, 2020
    Posts:
    8
    Thank you, I shall try that!
     
  22. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    38
    I followed these instructions but the T-Pose didn't have an 'avatar' on it (Synty Simple Zombie pack).
    Searched around and found advice on another site. Seems to be a problem with Unity 2019 (I ran into it on 2019.3.13f1)

    Posting it here to have all information in one handy thread (thanks OP!)
    1. install the Unity 2018 LTS
    2. create an empty project using that older version
    3. drag the T-Pose file into Assets, you should be able to see the avatar this time
    4. select the T-Pose in the Assets list, then Export Package
    5. switch back to your active project and Import Package|Custom Package
    This time the T-Pose should show the avatar as expected and you can continue to follow the instructions above.
     
unityunity