FollowHead.cs 631 B

123456789101112131415161718192021222324252627
  1. using Nxr.Internal;
  2. using UnityEngine;
  3. namespace NXR.Samples
  4. {
  5. public class FollowHead : MonoBehaviour
  6. {
  7. Transform mTransform, headTransform;
  8. // Use this for initialization
  9. void Start()
  10. {
  11. mTransform = this.transform;
  12. }
  13. // Update is called once per frame
  14. void Update()
  15. {
  16. if (headTransform == null)
  17. {
  18. headTransform = NxrViewer.Instance.GetHead().transform;
  19. }
  20. else
  21. {
  22. mTransform.localRotation = headTransform.localRotation;
  23. }
  24. }
  25. }
  26. }