Hi, Im working on a character controller where the player clicks somewhere in the world and the character moves to that point.
I have created a nav mesh agent that follows a target, the target moves to where clicked using the "click to move" then the nav mesh agent moves to that location using a follow script which is great.
Only problem I can't solve is how to animate this nav mesh agent? Also my agent moves backwards which is frustrating but i expect is a pivot problem.
Ive got this script but it doesnt like the .speed command, where have i gone wrong? (JavaScript)
function Start ()
{
// By default loop all animations
animation.wrapMode = WrapMode.Loop;
}
function Update ()
{
var currentSpeed = NavMeshAgent.speed;
// Switch between idle and walk
if (currentSpeed > 0.1)
animation.CrossFade("Walk");
else
animation.CrossFade("idle1");
}
↧