Home Technical Talk

What is the proper way to animate with root motion for games in mind?

morgannilsson
polycounter lvl 7
Offline / Send Message
morgannilsson polycounter lvl 7
Hello guy! As the title says, what is the "proper" way to animate to make root motion in games work?

The way I have gone about it right now is to move the root of the rig forward and then animate along that, which leads to pesky foot sliding that I have to manually correct every time I make a change. Feels a lot like I am working against myself and it kills a little bit of the fun in animation for me.

I have seen some videos where they use MAX's cat rig that have some magical auto-calculation for a root/translate bone that follows along the animation perfectly, and it seems to do it as a post-process since it only updates once you changed something.

I am animating in blender with my own rig and yeah, what is the proper way to animate with a root bone? Preferably without having to constantly readjust the curves so no footsliding occurs whenever you change something on the legs. 

Tutorial videos are welcome! I searched around quite a bit and I can't seem to find a single one that adress this issue, so it feels like I am trying to do something that is obvious to everybody else.

Best regards

//Morgan

Replies

  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    By root motion are you referring to animating along a distance, as opposed to cycling/looping in-place(which is how game characters are animated)?
  • morgannilsson
    Offline / Send Message
    morgannilsson polycounter lvl 7
    By root motion are you referring to animating along a distance, as opposed to cycling/looping in-place(which is how game characters are animated)?
    Yes, that you actually animate the character walking forward as opposed to just staying in place. This is pretty much how modern games does it as well as far as I know.

    https://youtu.be/d5z9dEnE4DE?t=4m28s

    This guy shows both, but I think he did it the same way as I did, basically moving the root motion forward and then adjust the curves to fix slippage.

    And then I saw this guy: https://www.youtube.com/watch?v=9IiNKcQ2J-c

    He animates freely without moving the root forward until the very end (yet it doesn't offset the character??)

    The more I look into this the more confused I get.
  • morgannilsson
    Offline / Send Message
    morgannilsson polycounter lvl 7
    Here is another more clear example. [VIDEO]https://youtu.be/4xF7AK4UjMI?t=6m45s[/VIDEO]

    At 6m45s
    The "root" thing he got is automatic and he isn't forced to constantly fix foot slides with curves when doing stuff with root motion in mind. I really want to know how to do this, because it makes it more fun and intuitive to animate.

  • RN
    Offline / Send Message
    RN sublime tool
    Hi. I think this "automatic root" thing you're seeing here only works because the exporter expects it that way.
    If that is truly the root bone (the top node in the hierarchy) then everything else should follow it, it shouldn't move based on other bone's movements.

    But a way to do what you want in Blender -- visually, at least -- is to use a Copy Location constraint on the root bone, to copy the X and Y world-space coordinates of the pelvis bone, without copying the Z coordinate (so the root is constrained to the XY plane, stays on the ground).

    You will also need to apply an inverse (you tick the 'inverse' checkbox) Copy Location constraint to the pelvis bone because when you move the pelvis the root will move as well, creating a "dependency" (pelvis moves root that moves pelvis that moves root etc.). This avoids the bones blasting off to some far away place.

    Also the pelvis is parented to the root bone, but it's not connected. The root bone has a custom shape as that blue arrow:



  • morgannilsson
    Offline / Send Message
    morgannilsson polycounter lvl 7
    RN said:
    Hi. I think this "automatic root" thing you're seeing here only works because the exporter expects it that way.
    If that is truly the root bone (the top node in the hierarchy) then everything else should follow it, it shouldn't move based on other bone's movements.

    But a way to do what you want in Blender -- visually, at least -- is to use a Copy Location constraint on the root bone, to copy the X and Y world-space coordinates of the pelvis bone, without copying the Z coordinate (so the root is constrained to the XY plane, stays on the ground).

    You will also need to apply an inverse (you tick the 'inverse' checkbox) Copy Location constraint to the pelvis bone because when you move the pelvis the root will move as well, creating a "dependency" (pelvis moves root that moves pelvis that moves root etc.). This avoids the bones blasting off to some far away place.

    Also the pelvis is parented to the root bone, but it's not connected. The root bone has a custom shape as that blue arrow:



    Hey, thanks a lot for the reply! In theory it looks like it could work as long as I bake the animation down, which seems to be something that is common for the others!

    However, it all goes bonkers and it behaves really erratic.

    Just to see if I got it right, I have a copy location constraint on the root pointing at the other bone where the x and y is ticked. 

    And on the other bone I have another copy location constraint pointing to the root, where x and y + inverse is ticked? I also tried without x and y ticked with only inverse ticked, same erratic behavior.

    Best regards

    //Morgan
  • RN
    Offline / Send Message
    RN sublime tool
    I think I understand better now what you're after.
    The way I have gone about it right now is to move the root of the rig forward and then animate along that, which leads to pesky foot sliding that I have to manually correct every time I make a change.
    There are two issues here:
    1) Unreal \ Unity or some other game engine uses the movement of the root bone to move the character.
    2) Animating using the root bone is unintuitive and makes it difficult to align things like feet.

    You want to animate like in that second video you posted, "How to Create Root Motion for Animations | Maya & Unity", where the guy moved the pelvis bone -- the second bone in the hierarchy, right below the root, and that still controls everything else -- so the feet will stay flat on the ground because of the IK chains of the legs. This way you move the full character with the hips and animate the legs with IK.

    When you're finished with the animation, the root bone doesn't move like it needs to for it to work in game engines.
    In Blender, using the Graph Editor mode you can copy the X, Y or Z location channels from the hip\pelvis bone and paste them to the root bone. Then you delete these position channels from the pelvis bone so it doesn't move around anymore, the root bone will. The result is visually the same except it's now in a way that the game engine wants.
    (Blender specific ->) Before doing this you need to add at least one 'location' keyframe to the root bone, a dummy keyframe so that the root bone has animation data and you can select both bones in pose mode and copy and paste keyframes from one to the other.
    It's standard use of the Graph Editor (it's in the Key -> Copy\Paste Keyframes menu), so it's a matter of reading how to use it. If you find yourself doing these steps a lot you can probably make a script for this later (like a macro, doing these steps faster).
  • morgannilsson
    Offline / Send Message
    morgannilsson polycounter lvl 7
    RN said:
    I think I understand better now what you're after.
    The way I have gone about it right now is to move the root of the rig forward and then animate along that, which leads to pesky foot sliding that I have to manually correct every time I make a change.
    There are two issues here:
    1) Unreal \ Unity or some other game engine uses the movement of the root bone to move the character.
    2) Animating using the root bone is unintuitive and makes it difficult to align things like feet.

    You want to animate like in that second video you posted, "How to Create Root Motion for Animations | Maya & Unity", where the guy moved the pelvis bone -- the second bone in the hierarchy, right below the root, and that still controls everything else -- so the feet will stay flat on the ground because of the IK chains of the legs. This way you move the full character with the hips and animate the legs with IK.

    When you're finished with the animation, the root bone doesn't move like it needs to for it to work in game engines.
    In Blender, using the Graph Editor mode you can copy the X, Y or Z location channels from the hip\pelvis bone and paste them to the root bone. Then you delete these position channels from the pelvis bone so it doesn't move around anymore, the root bone will. The result is visually the same except it's now in a way that the game engine wants.
    (Blender specific ->) Before doing this you need to add at least one 'location' keyframe to the root bone, a dummy keyframe so that the root bone has animation data and you can select both bones in pose mode and copy and paste keyframes from one to the other.
    It's standard use of the Graph Editor (it's in the Key -> Copy\Paste Keyframes menu), so it's a matter of reading how to use it. If you find yourself doing these steps a lot you can probably make a script for this later (like a macro, doing these steps faster).
    Hey, thank you so much for helping me through this! I appreciate it tons. 

    I tried this other way, and I found the benefits of moving the entire root and then animate along that outweigh the benefits of the copy paste hip to root translation way. 

    At least I learned a ton from all this experimenting!
Sign In or Register to comment.