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

Animator.Play causing character to teleport and play the animation.

Discussion in 'Animation' started by Milionario, Oct 8, 2020.

  1. Milionario

    Milionario

    Joined:
    Feb 21, 2014
    Posts:
    119
    I think this is probably related to the animation itself, but I don't know what causes it.

    I am just calling this:
    GetComponent<Animator>().Play("AnimationName");

    and my character teleports far away then plays the animation.

    EDIT: other animations do NOT cause this problem, the character stays in place.
    EDIT2: Turning off apply root motion on the animator solves the issue but I actually need root motion to be on.
     
    Last edited: Oct 8, 2020
  2. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,032
    You need to check the animation clip import settings of the faulty one and compare with the others.
    It's probably one of the following:
    1-You have baked the transform position in the animation clip setting
    2-The Root transform option "based upon" has a different setting than the animation being played before that
    3-The Root transform selected has a different initial position than the others. Not sure about this, but check anyway.
     
    Milionario likes this.