Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

My enemy walking animation keeps playing

Hello guys,

I've got a problem with my enemy AI. It works perfectly fine except when the AI stops moving it keeps on playing the walking animation, I've tried so many things and clicked every related link i could find but none worked.

I work with an animation blendtree and this is my code that handles the walking animation:

    if (agent.pathPending)

    {

      if (agent.remainingDistance <= agent.stoppingDistance)

      {

        if (agent.hasPath || agent.velocity.sqrMagnitude == 0f)

        {

          animator.SetBool("IsWalking", true);

        }

        else

        {

          animator.SetBool("IsWalking", false);

        }

      }

    }

And this is a pic of my blend tree although I really don't think the problem lies with the blend tree but rather with the coding.


Answers

Sign In or Register to comment.