标签:htc 眼镜 朝向
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); } }
这样,你人无论怎么站的,都会朝向你要规定的位置!
本文出自 “Unity_3D技术探讨” 博客,谢绝转载!
标签:htc 眼镜 朝向
原文地址:http://myselfdream.blog.51cto.com/9944020/1871814