unity商店的Standard Assets自带人物移动插件的bug修改
在使用第三人称视角进行操作的时候,发现人物在走坡度的时候,当坡度在X轴方向的时候,人物不能从跑步切换到走路,但是当坡度在Z轴的时候,人物可以顺利的从跑步切换到走路。 更改办法: 将ThirdPersonCharacter脚本中CheckGroundStatus方法中的: ```csharp if (Physics.Raycast(transform.position + (Vector3.up * 0.1f), Vector3.down, out hitInfo, m_GroundCheckDistance)) { m_GroundNormal = hitInfo.normal; m_IsGrounded = true; m_Animator.applyRootMotion = true; } else { m_IsGrounded = false; m_GroundNormal = Vector3.up; m_Animator.applyRootMotion = false; } 更改为:
if (Physics.Raycast(transform.position + (Vector3.up * 0.1f), Vector3.down, out hitInfo, m_GroundCheckDistance)) { m_GroundNormal = hitInfo.normal; if (m_GroundNormal.x != 0) { m_GroundNormal.z = m_GroundNormal.x; m_GroundNormal.x = 0; } m_IsGrounded = true ; m_Animator.applyRootMotion = true; } else { m_IsGrounded = false; m_GroundNormal = Vector3.up; m_Animator.applyRootMotion = false; }