Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Jump and Run Animations getting mixed up

Discussion in 'Animation' started by ScaryFace, Apr 3, 2020.

  1. ScaryFace

    ScaryFace

    Joined:
    Aug 7, 2015
    Posts:
    12
    Hey Guys

    My Run Animation sometimes plays when I press jump, I have tried fiddling with the settings, re scripted the controller. Deleted all the animations and put them back with new transitions and it still happens.

    If you look at the video around 16 Sec is where this bastard bug happens.

    Any ideas would be greatly appreciated.



    View attachment 590404
    upload_2020-4-4_10-5-47.png

    upload_2020-4-4_10-4-7.png upload_2020-4-4_10-5-4.png
     

    Attached Files:

    Last edited: Apr 3, 2020
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,491
    IsGrounded is most likely based on physics you are running in FixedUpdate while animations are evaluated in Update. So when you jump in one Update, it might be followed by a FixedUpdate that moves the character into the air or it might be followed by another Update so that after showing one frame of the jump it transitions to run because it has not left the ground yet.

    I don't know of a good way to avoid that issue in an Animator Controller, but if you use Animancer (link in my signature) you could easily implement whatever logic you want because you can freely control it with scripting instead of randomly putting some parts of your logic in a very limited Animator Controller and trying to work around its issues with scripts. If you are using Sprite animations then you might not need any of the Pro only features so Animancer Lite would do everything you need.
     
  3. ScaryFace

    ScaryFace

    Joined:
    Aug 7, 2015
    Posts:
    12
    It seems this may have been an issue with my Conditions. Once I added a IsGrounded (False) Condition from Any State to the Player_Jump Animation "which makes sense because we are airborne" the animations stopped getting mixed up.
     
  4. ScaryFace

    ScaryFace

    Joined:
    Aug 7, 2015
    Posts:
    12
    Thank you for the Reply, I will have a look at Animancer for sure!

    As for the Animations being evaluated on Update there is an option in the Animator component that allows you to set the Update Mode. When "Animate Physics" is Selected the animations will be in sync with the Fixed Update Call or so says the Documentation. :)
     
  5. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,491
    Yeah, if you're using that setting then the problem will be something else.