Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Mecanim users, are you using root motion?

Discussion in 'General Discussion' started by Zomby138, Aug 23, 2014.

?

Do you use mecanim's root motion?

Poll closed Sep 6, 2014.
  1. Yes, I use root motion

    16 vote(s)
    59.3%
  2. No, I use mecanim without it.

    9 vote(s)
    33.3%
  3. I don't even use mecanim.

    2 vote(s)
    7.4%
  1. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    I'm curious how many people actually use the root motion mecanim feature.

    Feel free to give your reasons for or against.
     
  2. CodeMonke234

    CodeMonke234

    Joined:
    Oct 13, 2010
    Posts:
    181
    Been wondering which approach to take - to use root motion will require building animations that have it .... Many of the ones I have don't have it
     
  3. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Unless you're doing a very specific humanoid only thing that requires very specific matching to nearby geometry for instance, like climbing a ladder in a realistic game, you will have no use for it. I'm not sure why it's a poll when it's a tool for a very specific set of solutions. You know if you need it :)
     
    calmcarrots likes this.
  4. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    I'm doing those exact kind of things in my game. Matching hands to ledges at the end of a jump etc. I'm not using root motion (or by extention the target matching). I've just writen my own code to do it using the IK targets and some maths.
     
  5. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    I know this is bad, but I honestly don't even know what root motion does. I tried checking and unchecking the option for my characters and it did nothing for me (or against me lol). So, on some of my models I'm using it without even knowing what it does, and on others it's unchecked.

    I havn't taken the time to read up on what it's supposed to do. I'm sure it affects performance in some manner but it's not large enough to tell in my game.
     
  6. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    I thought root motion was what allow mecanim state machines to transition from one state to another based on speed or other parameters you set up. Is that not the case?
     
  7. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,613
    Imagine that you've animated a character walking, and in the animation you've made them actually move away from their start position - if you played that on loop in game, then not only would they keep snapping back to the start, but they'd also be moving away from where their GameObject actually is.

    Root Motion analyses the walk and moves the character's GameObject to be in sync, such that both problems are solved.
     
  8. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,543
    Additionally, root motion makes it that the movement speed of your character is determined by the animation. This gives it a more realistic feel, as a natural walk or run gait doesn't produce a constant speed. It also eliminates the foot sliding phenomenon that older games have.

    But this also means it's more difficult to rein in the character's movement. If you're making a strategy game and you need the character to move and stop at the exact spot you clicked, the code to do that is different from the usual, as you have to take into account that the character takes time slowing down their walk/run before coming to a complete stop.

    I would actually love to do that but haven't had the time to think exactly how to do it. I only recently got a Pro (from job) and haven't had the time to play around with the Pro-only features.
     
    Last edited: Aug 23, 2014
    ForgottenCheese likes this.
  9. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    That is pretty interesting. Thanks for the info. Never really knew what it did till now then :)
     
  10. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,238
    Root motion is great for walk loops that don't keep the same speed throughout and other animations like limping etc. I prefer to use it myself. Saves the walking on ice situation. lol
     
  11. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    I have implemented a physical character controller where the current speed is just forwarded to the animator. Overall the result is better in my opinion. If you are using root motion, the walking looks more realistic, that's true, but as soon as you walk against a wall the situation changes.
     
  12. Jingle-Fett

    Jingle-Fett

    Joined:
    Oct 18, 2009
    Posts:
    612
    Doesn't have to only be humanoids though. For example, you can also use it to do stuff like in Half-Life 2 where a headcrab might appear, then climb up over some obstacles and into a vent in a scripted in-game cutscene. But yeah, the use cases are pretty specific.
     
  13. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Root motion is also used if you absolutely want animation to dictate gameplay with in-place foot planting. This is something I don't really go for, as it does impact how the game feels. It's graphics > gameplay instead of having a compromise of a tiny bit of slide nobody really notices anyway.
     
  14. 0tacun

    0tacun

    Joined:
    Jun 23, 2013
    Posts:
    245
    John Mac has an excellent tutorial series for mecanim and using root motion. He is recreating the movement from The Legend of Zelda: Wind Waker:


    Root motion gives a very good feeling of "weight" into the controls, something western games didn't used much. Assassin's Creed is also a good example for "weight" in the animations.
     
  15. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,543
    Well for root-motion-based character systems, isn't that done by changing the animation playback speed? That would effectively change the movement speed as well.

    Also, how would one go about making such a thing work properly with a CharacterController? Since the proper way to move the CharacterController is via script i.e. Move method.
     
  16. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    If you run against a wall, there will usually be a delay if you e.g. run against a wall and the animation will look ugly. It is comparable to an immediate stop, which is almost not achievable with the root motion.

    If you call Move in the CharacterController, you also feed that value to the animator. Of course you have to convert it whatever the animator expects.
     
  17. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    @AnomalusUndrdog, mecanim can handle CharacterController without writing a single line of script code.

    The Animator detect when there is a CharacterController on the same gameobject and that you don't override MonoBehaviour.OnAnimatorMove callback. In such case we do compute the velocity and send it directly to the CharacterController.
     
    theANMATOR2b and AnomalusUndrdog like this.