浏览代码

Update Character.cs

/main
mwert09 4 年前
当前提交
fa308200
共有 1 个文件被更改,包括 0 次插入15 次删除
  1. 15
      UOP1_Project/Assets/Scripts/Characters/Character.cs

15
UOP1_Project/Assets/Scripts/Characters/Character.cs


{
isJumping = false; //This will stop the reduction to the gravity, which will then quickly pull down the character
}
private void UpdateSlide()
{
// if player has to slide then add sideways speed to make it go down
if (shouldSlide)
{
movementVector.x += (1f - hitNormal.y) * hitNormal.x * (speed - slideFriction);
movementVector.z += (1f - hitNormal.y) * hitNormal.z * (speed - slideFriction);
}
// check if the controller is grounded and above slope limit
// if player is grounded and above slope limit
// player has to slide
currentSlope = Vector3.Angle(Vector3.up, hitNormal);
shouldSlide = currentSlope >= characterController.slopeLimit;
}
}
正在加载...
取消
保存