Question by
DavidSarre · Aug 16, 2017 at 01:21 PM ·
thirdpersoncontroller
Third Person Character Controller slightly slides back after jump
When jumping from idle state with the third person controller, it slightly slides back. Here is a gif:
View post on imgur.com
Now, on my way to find out what's happening I saw these lines in the ThirdPersonCharacter.cs:
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 thought that might be the place where magic slide happen and by adding some Debug.Log I am pretty sure this is it but these Debugs gave me very strange results:
m_animator.deltaPosition is always equals to Vector3.zero
m_MoveSpeedMultiplier is always equals to 1
v is NOT always equals to Vector3.zero
When player lands on the ground, v.x starts being negative before going back to zero.
How is this possible ??
Comment