Search Unity

The animation changes the position of the gameobject

Discussion in 'Animation' started by fdojruiz, Jun 8, 2022.

  1. fdojruiz

    fdojruiz

    Joined:
    May 9, 2022
    Posts:
    8
    Hello.

    I have a prefab with its position (0,0,0) and an animation that loops back on itself. When I position the prefab in the scene it stays correctly in the position where I put it, but when the animation is launched it goes to the coordinates (0,0,0).

    Does anyone know why this happens?

    Thanks for the help.
     

    Attached Files:

  2. MarekUnity

    MarekUnity

    Unity Technologies

    Joined:
    Jan 6, 2017
    Posts:
    207
    It looks like your animation sets position of your game object. Do you place your prefab on top of the hierarchy? If your intention is to animate local position of your object maybe you could place it under a parent game object and then move the parent game object to your desired position.
     
    fdojruiz likes this.
  3. fdojruiz

    fdojruiz

    Joined:
    May 9, 2022
    Posts:
    8
    Hello.

    I found the fault. I had unchecked the "Apply Root Motion" box in the Animator component.

    Thanks.
     

    Attached Files:

    MarekUnity likes this.