Third Person Character Controller slides back after jump (Include dark mathemagic)

Hi everyone,
I know we are not using the jump ability of the third person character controller but I do, and I have found it acting weirdly.
After a jump from idle state, when the player lands on the floor the player slides backward a little. (I’ve tried changing physics materials on player and on ground it doesn’t change anythin)
In my search to find out where this sliding behaviour comes from I have found that it might come from a method OnAnimatorMove in the third person controller script which set player’s velocity after animation played.

The way it updates velocity is the following:

Vector3 v = (m_Animator.deltaPosition * m_MoveSpeedMultiplier) / Time.deltaTime;
m_Rigidbody.velocity = v;

It looks OK however if I add this debug:

Debug.Log(m_Animator.deltaPosition + " * " + m_MoveSpeedMultiplier + " / " + Time.deltaTime + " = " + v);

I get weird output like :
(0.0, 0.0, 0.0) * 1 / 0.01686154 = (-2.5, 0.0, 0.0)

That v.x value explains the magic slide but how v could be what it is when multiplying by 0 ??

Privacy & Terms