walking animation does not work properly

Hello there,

I have a character in 3D using a rigidbody to move and this script:

        void FixedUpdate(){
                //walking
                Vector3 moveSpeed=transform.forward*inputManager.move() * Time.fixedDeltaTime * walkingForce;
                rb.MovePosition(rb.position+moveSpeed);
                //TODO only when grounded
                Debug.Log("walkingspeed:"+moveSpeed.magnitude);
                if(inputManager.move()!=0){
                        anim.SetBool("walking",true);
                }
        }

With this script and the change from idle to walk set to “walking equals true” and the change from walk to idle set to “walking equals false”, the character animation for walking is only displayed once. Why does it swap back to idle while the key is still pressed?
I used speed before. And gave the float-variable the speed of movespeed.magnitude which equals to 0,038(according to the debug you can see). I set the change in the animator controller to speed greater than 0,01 and I tried 0,001 too but with that option the animation did not change at all.

I would like to know the mistakes in both variants.
I think I described everything but in case more information is needed to solve it, please ask me.


(the not working picture and the working picture are the same but I can not delete the not working one when editing this post)

Greetings

The animation is not set to loop, perhaps? Since I see no posted code that sets the bool back … unless you have some other type of return transition not posted.

Not sure about your other issue, unless you mistyped the variable name, I believe it should have worked, also.

I am having this issue again. Change from idle to walking is only the walking set to true and from walking animation to idle it is set to walking false. I am changing the variable on:

if(inputManager.move()==0){
anim.SetBool(“walking”,false);
}
else{
anim.SetBool(“walking”,true);
}

In other words: It is impossible to move without having that variable set to true. I am returning the variable to verify:
Debug.Log(anim.GetBool(“walking”));
It is true when walking and false when not walking. But most of the time the idle animation is played while walking. Why? I have set loop time and loop pose of those actions to true.

Is there any better way to debug this? What is “solo” and “mute” for in the state-settings in the animator? How can it be that it is playing the idle animation while the walking-boolean is true? I really don’t get it and need help. If any more information is needed to debug this please ask me, i think i have written every information needed(still beginner in unity).

Thanks for reading this and your time in advance

[Edit] found it: The mistake was that I added a jumping-state without giving any conditions(I wanted to add them later) and so it was using that state to go back. It is always using transitions without conditions not never using them as I expected. [/Edit]

Ah, glad you solved it. I believe a transition that has “has exit time” can exist without any conditions.

As for your question in the middle about ‘solo’ and ‘mute’, I forget what they mean without looking it up, but it’s in the documentation :slight_smile: I’ve read it before, just forgotten lol. Never used it… :slight_smile: