Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Character stops briefly when toggling applyrootmotion on and off

Discussion in 'Animation' started by MMeyers23, Mar 28, 2021.

  1. MMeyers23

    MMeyers23

    Joined:
    Dec 29, 2019
    Posts:
    101
    Hi, I have a fairly basic issue that I can't figure out how to solve. I have a character that runs around and its movement is driven by rootmotion. However, when the character jumps, I toggle rootmotion off and I use physics to move the character up and a script drives the movement while airborne. I have a script that turns applyootmotion to true again when the character lands.

    Problem in a nutshell: the character stops for a split second when turning applyrootmotion back on.

    The character can move around slightly and change direction in middair (its a 3D platformer) to help land the character where the player wants. However, upon landing (in the landing animation the character movement is driven by script just like in middair, NOT based on rootmotion), when the character transition back into regular locomotion and rootmotion is toggled on, the character abruptly stops for a split second before going into root-based movement. This causes the camera (which follows the character) to abruptly stops and it looks very jerky. The effect is feel very laggy and feels horrible.

    How can I switch from script-driven movement to root-based motion without the character stopping for a split second in between?