Hello,
I’m looking at the ThirdPersonCharacter in Standard Assets, and I see the walking speed is determined in the following method:
public void OnAnimatorMove()
{
// we implement this function to override the default root motion.
// this allows us to modify the positional speed before it's applied.
if (m_IsGrounded && Time.deltaTime > 0)
{
Vector3 v = (m_Animator.deltaPosition * m_MoveSpeedMultiplier) / Time.deltaTime;
// we preserve the existing y part of the current velocity.
v.y = m_Rigidbody.velocity.y;
m_Rigidbody.velocity = v;
}
}
I don’t understand what the Animator.deltaPosition property is, also after reading the documentation that says:
I would like to be able to set the maximum walking speed in meters per second. How would I do it?
Thank you in advance for your help. 
Hi there,
[EDIT / TLDR] If you are using default scale I believe your velocity is already in metres per second.
By default I believe that 1 unit in unity == 1 metre.
When it comes to movement in unity (non-mechanim driven) we often want to move an object at a particular velocity in a frame rate independent fashion. We do this by multiplying the velocity by Time.deltaTime.
However in the example above you are already given the distance moved since the last frame from the animator. So what the code is doing is dividing this by Time.deltaTime to get the real velocity not the velocity per frame. I hope that makes sense.
For examples sake to make it easy lets say each frame in your game was running at a quarter of a second (what a miserable game!). And in that time it takes to move to a new frame your m_Animator.deltaPosition code told us we have moved exactly 1 unit (ignoring the speed multiplier for simplicity). This means that your actual velocity is 4 units per second, or 4 metres per second using default scale.
Armed with this information on what your current velocity is and what your max velocity is you could do something like; if the current velocity is greater than max velocity then just set the current velocity to your maximum value.
I hope someone will correct me if I am wrong 
Kind Regards,
Joe
2 Likes
Sorry for the very late reply @JoeMcDowall , I had forgotten to reply!
Thank you very much for your answer, I think now it is all clear. 