HTC头盔镜头需要一进到场景就朝向某个方向,也就是强制执行朝向问题!
GameObject cameraEye; void Start () { cameraEye = null; } // Update is called once per frame void Update () { if (!cameraEye && transform.FindChild ("Camera (eye)")) { cameraEye = transform.FindChild ("Camera (eye)").gameObject; float angleRota = transform.rotation.eulerAngles.y - cameraEye.transform.rotation.eulerAngles.y; transform.Rotate (0, angleRota, 0); transform.position -= new Vector3(cameraEye.transform.position.x - transform.position.x, 0, cameraEye.transform.position.z - transform.position.z); } }
这样,你人无论怎么站的,都会朝向你要规定的位置!
时间: 2024-10-11 17:39:47