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. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Resolved Why does my animation stop working for turn 180 degrees animations?

Discussion in 'Animation' started by andypett, Nov 20, 2022 at 8:22 PM.

  1. andypett

    andypett

    Joined:
    Jun 11, 2019
    Posts:
    12
    I have seen this question posted a couple of times, but none of the answers helped me. And I can't understand this problem.

    I am currently working on an enemy character, so I am using NavMeshAgent to actually move the character.
    Animator root motion is set to false.

    I have imported animations from Mixamo, Unity Standard Assets and other animation packs. All with the same result.

    NOTE! This is only a problem for animations that turn 90 or 180 degrees on the spot (left or right makes no difference). All other animations (including animations that turn slightly) work.

    When I preview the animation with my character model in the preview, it works fine.
    But when I take the animation clip into the animator controller of the character, the animation will not work. The character will make a quirky move in stead of turning 180 degrees (also the case with 90 degrees animations).

    If I try to change the rig of the animation and use "Copy from other avatar", I get this error message:
    unityerror.jpg

    This is the case, even when I have downloaded the animation, with skin, from Mixamo and I use the same character's avatar. So it doesn't make sense that this error message should appear.

    It makes even less sense because this is the avatar configuration.
    unityerror2.jpg

    All other animations work (they use the same avatar, and I have tried with several different avatars).
    It's only animations that turn 90 or 180 degress on the spot that does not work.

    Does anybody see what I'm missing here?
     
  2. andypett

    andypett

    Joined:
    Jun 11, 2019
    Posts:
    12
    There's just something about posting a question that activates my brain cells again, even at this hour.
    I realized that I'm describing my problem in my question - I have turned off root motion.

    I have a state machine system that allows each state to choose whether or not to use root motion, and when I get to the point of turning 90 or 180 degrees, then of course I will need to use root motion.
    In my other animations, I am playing the animation without root motion, but the NavMeshAgent is also calculating the desired velocity, and turning my character based on that.

    When turning on spot I am not calculating the desired velocity.
    So, if anybody else run into this problem - you need to have root motion turned on OR you need to calculate the rotation and make sure the NavMeshAgent rotates the character for you.
     
unityunity