Search Unity

Make character stand still when player stops

Discussion in 'Animation' started by Offset35, Dec 5, 2019.

  1. Offset35

    Offset35

    Joined:
    Nov 29, 2019
    Posts:
    4
    Hey there folks. When i stop pressing arrow keys my character stops. But he's stuck on running animation. I want it to switch to Idle animation.
    Here's my code:
    upload_2019-12-5_19-47-5.png
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Have you printed out the values you use to set the animator's animation blending? You probably derive idle-walk-run from that Magnitude float you set?

    It's most likely wrong and that's why your animator continues performing walk animation even if the GameObject on the screen has stopped moving.

    But it would help if you also showed your animator setup, there could be something wrong, too
     
    Offset35 likes this.
  3. Offset35

    Offset35

    Joined:
    Nov 29, 2019
    Posts:
    4
    upload_2019-12-5_20-21-39.png
    That's my animator setup
     
  4. Offset35

    Offset35

    Joined:
    Nov 29, 2019
    Posts:
    4
    And yes you are right about idle-walk-run. But i don't know how i can fix it. I'm not using a walk animation so that's the problem like you said. Please help me out!