我使用unity商店Standard Assets自带人物移动插件的时候,在使用第三人称视角进行操作的时候,发现人物在走坡度的时候,当坡度在X轴方向的时候,人物不能从跑步切换到走路,但是当坡度在Z轴的时候,人物可以顺利的从跑步切换到走路(即使同一个坡度,转一个方向,就不能使用了),如下图所示,红色的是无法进行动画切换的,白色的可以顺利的切换,谁知道这是怎么回事啊???
(我使用这个插件,就是因为可以在上坡的时候切换状态,比自己写人物的操作要方便点;查看代码以后,是动作融合树里面的判断条件进行控制,但是找不到在哪里控制的)
你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答
本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。
因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。
将ThirdPersonCharacter脚本中CheckGroundStatus方法中的:
if (Physics.Raycast(transform.position + (Vector3.up * 0.1f), Vector3.down, out hitInfo, m_GroundCheckDistance))
{
m_GroundNormal = hitInfo.normal;
m_IsGrounded = true;
m_Animator1.applyRootMotion = true;
}
else
{
m_IsGrounded = false;
m_GroundNormal = Vector3.up;
m_Animator1.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;
}