What does desiredVelocity do?

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);
    }

DesiredMoney = How much money do you want in your bank account?
Money = How much money you actually have in your bank account.

Same concept.
Desired Velocity = “The speed I WANT to go.” (Max Speed)
Velocity = “The speed I am actually going”. (Current Speed)

4 Likes

@Cynikal Thank you so much