浏览代码

Other Fixes for FirstPersonController

/main
Thomas ICHÉ 5 年前
当前提交
2b12dd01
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 12
      Runtime/Controllers/FirstPersonController.cs

12
Runtime/Controllers/FirstPersonController.cs


float realHeight = PlayerHeight + PlayerRadius;
var controller = GetComponent<CharacterController>();
var center = new Vector3(0, realHeight / 2, 0);
controller.center = new Vector3(0, realHeight / 2, 0);
controller.height = realHeight;
controller.radius = PlayerRadius;
if (controller.center != center)
controller.center = center;
if (controller.height != realHeight)
controller.height = realHeight;
if(controller.radius != PlayerRadius)
controller.radius = PlayerRadius;
if(m_Camera != null)
m_Camera.transform.localPosition = new Vector3(0, PlayerHeight, 0);

正在加载...
取消
保存