浏览代码

Merge pull request #16 from Quickz/player-jump-fix

Tested in the scene and it seems like it fixes the issue. Thanks @Quickz, merging!
/main
GitHub 4 年前
当前提交
a5b785a6
共有 1 个文件被更改,包括 22 次插入0 次删除
  1. 22
      UOP1_Project/Assets/Scripts/Characters/Character.cs

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


turnSmoothTime);
}
}
private void OnControllerColliderHit(ControllerColliderHit hit)
{
if (isJumping)
{
// Making sure the collision is near the top of the head
float permittedDistance = characterController.radius / 2f;
float topPositionY = transform.position.y + characterController.height;
float distance = Mathf.Abs(hit.point.y - topPositionY);
if (distance <= permittedDistance)
{
// Stopping any upwards movement
// and having the player fall back down
isJumping = false;
gravityContributionMultiplier = 1f;
verticalMovement = 0f;
}
}
}
//---- COMMANDS ISSUED BY OTHER SCRIPTS ----

正在加载...
取消
保存