CompassUI.cs 440 B

123456789101112131415161718
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace Imagine.WebAR.Demo{
  5. public class CompassUI : MonoBehaviour
  6. {
  7. [SerializeField] Transform cam;
  8. [SerializeField] RectTransform pointer;
  9. void Update()
  10. {
  11. if(cam != null && pointer != null){
  12. pointer.localEulerAngles = new Vector3(0, 0, -cam.eulerAngles.y);
  13. }
  14. }
  15. }
  16. }