Hi,
What does desiredVelocity do? What’s diffrence between velocity ? And why should i use it ?
Example Code:
oid NavAnimationUpdate()
{
speed = Vector3.Project(agent.desiredVelocity, transform.forward).magnitude;
// angle is the angle between forward and the desired velocity.
angle = FindAngle(transform.forward, agent.desiredVelocity, transform.up);
// If the angle is within the deadZone
// set the direction to be along the desired direction and set the angle to be zero.
if (Mathf.Abs(angle) < deadZone)
{
transform.LookAt(transform.position + agent.desiredVelocity);
angle = 0f;
}
animSetup.Setup(speed, angle);
}