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

Character controller falls behind the player animation

Discussion in 'Animation' started by Aitra, Sep 8, 2022.

  1. Aitra

    Aitra

    Joined:
    Feb 2, 2022
    Posts:
    5
    Hi guys

    Can you spot the problem why the character controller falls behind the walking animation and how to fix it?
    the worst part is at the end of each animation cycle the player gets pulled back into the character controller :/
     

    Attached Files:

  2. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    599
    Yep, the issue is that the animation is moving the character's position. In other words, it's not a loop. To fix this, you have to modify the animation and make it a loop (keep the character in the same spot so that it looks like they're walking in place).

    Alternatively, you can use root motion:

    https://docs.unity3d.com/Manual/RootMotion.html

    Root motion moves the character with its animation, not by script. I think Unity's character controller is compatible, but I've never set it up before.
     
    Aitra likes this.
  3. Aitra

    Aitra

    Joined:
    Feb 2, 2022
    Posts:
    5
    yep that was it. Thank you very much!!
     
    Unrighteouss likes this.