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\$
1

1 Answer 1

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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .