0
\$\begingroup\$

What's the best way to create a simple moving navmesh agent with animation? (e.g. a human enemy running to player)

I have run animation that moves the enemy

enter image description here

public void Run () 
{
    animator.SetFloat ("Speed", 1f);
}

but I am not sure how to combine it with navmesh.

In one tutorial I saw Standard Assets ThirdPersonController .Move(...) used for that, but I am not sure if I should use it for that purpose, as I understand it was intended only for player characters?

Or should I use animation that runs in place?

\$\endgroup\$
2
\$\begingroup\$

You need to attach this animation to your player gameobject and in code (the third person controller does this as an example) set a variable whenever it's moving and send it to the animator. Then in the animator for the player have the transition between (i'm guessing) "Idle" and "Run" be based on the state of that variable.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.