CameraToLook.cs 503 B

12345678910111213141516171819
  1. using System;
  2. using UnityEngine;
  3. /* 弓的摄像机总会LookAt该节点的Point子节点
  4. 九轴数据是直接应用到该节点的(特意分离而不直接应用到弓的摄像机) 是为了避免z轴旋转
  5. */
  6. public class CameraToLook : MonoBehaviour
  7. {
  8. [NonSerialized] public Transform point;
  9. public static CameraToLook ins;
  10. void Awake()
  11. {
  12. ins = this;
  13. point = transform.Find("Point");
  14. }
  15. void OnDestroy()
  16. {
  17. if (ins == this) ins = null;
  18. }
  19. }