- Home /
What does this formula mean?
agent.velocity.magnitude / agent.speed
I usually use it when I use "animator.SetFloat()"
Answer by Captain_Pineapple · Apr 06 at 01:01 PM
Context is always crucial in something like this. As a rule of thumb: if your question is less than 5 sentences, it is probably not describing the problem with enough detail.
Now assuming that agent
is a navmesh agent then velocity
is your current speed vector and speed
is your maximum speed value (scalar).
So what that code does is give you a value between 0 and 1 of how fast your agent is going in relation to its maximum possible speed where 0 is stating still and 1 is max velocity in any direction.
Your answer
Follow this Question
Related Questions
problem with mathf.tan 2 Answers
Need a little help with quick angle equation 2 Answers
CharacterController on Moving Surface 4 Answers