Search Unity

Root motion added to in-place animation but character still not moving forward.

Discussion in 'Animation' started by Maegwin, Mar 16, 2015.

  1. Maegwin

    Maegwin

    Joined:
    Feb 26, 2015
    Posts:
    5
    I have a non-human character I modelled and animated in Maya. It has an in-place walk cycle. I was asked to add a root motion to the walk-cycle animation in Maya. I did that. The character now takes a couple steps forward along the Z axis. I made sure the root joint of the skeleton (hips) was selected when I keyed the forward Z animation.

    I baked the animation, exported the FBX and opened it in Unity. I'm still quite new to Unity and I may be simply missing a step.

    In the tutorial I was using, their character moves forward smoothly across the grid in the preview window after they apply the humanoid rig and make sure all the bones are green in Mecanim.

    Being that my character is not humanoid (has backward bending knees) I cannot apply the Mecanim Humanoid rig or it breaks my characters legs. I'm not sure how to apply the the Mecanim settings to a non-human character using a generic rig.

    That said, I tried applying the humanoid rig any ways like the tutorial suggested and made sure all of my settings matched the tutorial's. All of the bones were green (except for the toes, hence the wonky feet of the character in the preview window). My Translate Z velocity was above point zero as well (at 0.897). But my character still did not move forward. It still popped back to it's start frame repeatedly in the preview window.

    See the screenshot below.

    How do I get this working?

    animation_settings.jpg
     
  2. medhue

    medhue

    Joined:
    Aug 24, 2014
    Posts:
    176
    OK, first, you don't need to use the HUMANOID rig. Just use GENERIC. I know it's confusing, as I made the same mistake thinking this, but MECANIM really has nothing to do with the HUMANIOD rig, but the whole system to use your animations. I think.;)

    Once you have it set to generic, you then must choose the ROOTBONE for the system to know which bone is the root. Generally, when I make a rig, I have a main rootbone at floor level, usually below the character's center of gravity. I then usually have a COG bone, for the IK, and then the pelvis bone. That's probably more bones than I need, but that is the way I like it.

    With your generic rig, and rootbone APPLIED, now when you goto your walk with the root motion, and choose loop, and play, it should work as expected. Good luck! Maybe I'll do a tutorial on this.
     
    Maegwin likes this.
  3. Maegwin

    Maegwin

    Joined:
    Feb 26, 2015
    Posts:
    5
    Which field do I input the rootbone in to? There are a few to choose from and Unity is still foreign to me. :p

    For my rig it would just be "hips". I hope that will work. Also, what is a COG bone? I don't have any IK's on this rig. It was a test animation and animated the skeleton itself for speed sake.
     
  4. medhue

    medhue

    Joined:
    Aug 24, 2014
    Posts:
    176
    When you set up the rig, Generic, you also set the rootbone. Between 4.6 and 5.0 there is a difference in how the rootbone settings affected the animations in the animation set up, but I haven't played with 5.0 enough to know exactly what the differences are. I do know, that if you set the rootbone in the rig set up, then when you loop and play the animation in the animation set up, the root motion should work.
     
    Mecanim-Dev and Maegwin like this.
  5. Maegwin

    Maegwin

    Joined:
    Feb 26, 2015
    Posts:
    5
    Thank you! It worked! Your feedback has been great and really informative. :)
     
  6. medhue

    medhue

    Joined:
    Aug 24, 2014
    Posts:
    176
    I did mention Root Motion in my latest video. It's kind of a product demo too, but I go over briefly how I make rigs and do root motion. This is, of course, just how I do it, and is not how everyone should.

     
    twda likes this.
  7. vvaris

    vvaris

    Joined:
    May 23, 2013
    Posts:
    26
    I try to the exact same thing as you but it says that "root motion is driven by curve" and I cannot set the XZ position to root! EDIT: Ok, found out it works only for generic. I would like to use Humanoid..
     
    Last edited: Mar 19, 2015