My player moves for my idle and walk animation

sj8j9n

If someone knows howw to fix this, let me know

I’m assuming you’re switching between them in the animator?

Find out why they’re switching and then fix that.

If you still need help, you need to give more information.

Too many possible causes here, Need more info.

if someone

I think that this thing is caused becasue the idle animation is from mixamo and the right foot is lower that the the left one, so, when i apply force when i switch from one animation to another, this happens

I posted some animator photos and the inspector of the player, let me know if you need something more

How are you switching between the animator states? What are your conditions? What is the code you’re using for this? What does the animator look like when the game is running and the issue is occurring?

i am switching animator states with the script assigned to the playe object called " Animation State Controll" and this is the script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class animationStateController : MonoBehaviour
{
    // Start is called before the first frame update
    Animator animator;
  
    void Start()
    {
        animator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
      
      
        controlWalking();
        controlRunning();
      
    }

    private void controlWalking() {
        bool walkPress = Input.GetKey(KeyCode.W);
     
         if(walkPress) {
            animator.SetBool("isWalking", true);
        } else if(!Input.GetKeyDown(KeyCode.W)) {
            animator.SetBool("isWalking", false);
        }
    }
    private void controlRunning() {
        bool runPress = Input.GetKey(KeyCode.LeftShift);
        bool walkPress = Input.GetKey(KeyCode.W);
         if(runPress &&  walkPress) {
            animator.SetBool("isRunning", true);
        } else if(!runPress || !walkPress) {
            animator.SetBool("isRunning", false);
        }
    }
}

i am switching the animator states with the bool parameters “isWalking” and “isRunning”

The animator works normally as it should be but the problem still occurs

I don’t see any issues with the code. Did you actually set any conditions in the animator transitions? Are the states switching because you have exit time enabled? If we could see the actually conditions that are firing incorrectly, that would be helpful.

The same is for the running transitions but with the isRunning condition


Okay, I’ve completely misunderstood the issue. I read the title as “My player moves FROM my idle and walk animation” instead of “for.”

So, the issue is that your player is moving when you play those animations?

The walk animation seems to have built in root movement. Pretty sure it’s made to use root motion, not sure if there’s an easy way to fix that aside from just using root motion:
8882388--1213629--Root Motion.JPG

Your character is falling over; this is likely because of your Rigidbody settings. To fix this, you could try freezing x and z rotation:
8882388--1213632--Rigidbody.JPG