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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Can I override root motion via timeline without adding a parent?

Discussion in 'Timeline' started by bitinn, Jun 8, 2022.

  1. bitinn


    Aug 20, 2016

    A question comes up while using Timeline recently:

    - say we have a root motion animation that go forward along XZ plane.

    - say now we want to quickly animate the character going down a slope (adding a Y axis movement).

    - without extra IK, it appears the easiest approach is to append a parent gameobject to the character, then we can append the Y axis movement.

    - I understand there exists an animation override track, but it only support masked animation (eg. I can mask the upper body to blend 2 animations), not masking a movement direction.

    - what we would like to do is: mask all Y axis root motion (in our case there isn't any to begin with) and apply the extra movement via timeline animation. Is it possible via an override track, or is the parent game object approach our only solution?

  2. akent99


    Jan 14, 2018
    My understanding (which may be faulty). It depends on whether the animation is Humanoid or not.

    For a non-humanoid animation clip, you can just go for it. Each property gets its own animation track, its really easy to add override tracks and animate anything you feel like. E.g. I add animations for facial expressions using animation tracks without worrying about masking etc., because the facial expressions are not part of the Humanoid Avatar description.

    For humanoid properties, its all or nothing by default. Any override takes full control over everything. Avatar masks let you do something better (like "left arm" or "upper body" as you mention). But the Humanoid Avatar Description basically defines what is a part of what. You cannot just override the Y position then - its owned by the Humanoid stuff to do things like root motion. No merging. And there is no Avatar Mask that I know of for "just the Y value". Hence the wrapping container object approach. That container is not part of the Humanoid definition, so you can add an override track on it without causing problems.

    I have not explored Foot IK much - not sure it would adjust the character Y value.

    I have tried writing my own scripts to dynamically compute the position of the character at runtime (e.g. work out where the ground is and dynamically update the Y value based on that) and generally given up on that approach. Scrubbing the Timeline object does not work as well - it might not show the right thing unless the Y-value is deterministic based on the current time value. E.g. scrubbing from the end to the start of the timeline might end up with the character falling through the floor.

    The other advantage of a container object is animation clips sometimes do include a bit of Y-motion that is nice to keep (the character bobbing up and down during a walk cycle). Overriding the Y-value can lose this without the enclosing parent object.

    I would love to hear if there is a better way as well, but the enclosing parent object has worked best for myself so far.