Animator.Play() messes with position.

Hello, a few days ago i posted a problem that i encountered in hopes of finding a solution which can be found here . It was never solved but i kinda were able downgrade the problem into single variable. When i trigger anim.Play() character moves to another spot in XZ plane which is not far from the original position.

Animator anim;

    void Start()
    {
        anim = GetComponent<Animator>();
    }

    void Update()
    {
        if(Input.GetKey(KeyCode.P))
        {
            anim.Play("Stand Up",0,0);
        }
    }

As you can see code is very simple. Animator controller is composed of only “Entry” being connected to a state named “Stand Up”. I can’t figure out why this “shift” happens. Disabling root motion fixes this problem but it is not an option for me.

I’m having a similar problem but sorta in reverse.

My problem is that when I built my animation frames in Maya, I created it at zero’d out. I then placed it with an adjusted position and rotation as a child of another object within Unity. So new position, and a new rotation in front of the camera and childed to the camera.

When I run my animation, the sword will snap to the zero’d out local transform of the parent which is my camera. The result being that the sword would skip frame up into my characters head, play the animation, then return to it’s placement once the animation finished. I found a solution to the problem by applying the root motion… but further on in my original post you can see the root motion was causing me other issues.

https://forum.unity.com/threads/sword-swing-animation-problems.640615/

Sound like that may be solved by parenting your character to the sword and then animating it.

Can’t do that, then the character would animated with the sword =p

For now with root motion applied , I’m force resetting the transform values of the sword once the animation time finishes.

Try changing the import settings on the animation asset. Uncheck “bake into pose” on the XZ motion option.
Also change it to “Use Original”

Thanks for your answer. I “kinda” solved the problem by fixing the character’s position for a few frames after initiating the “get up” process. Again the problem with this is even though i fix the position in LateUpdate(), character teleports back to a random position for a single frame and then gets back. And i solved that by doing a linear interpolation between ragdoll position and animation position. It annoys me to use such complex solutions for such a ridiculous problem but thats it.