VuforiaLocation.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using SC.XR.Unity.Module_ShadowSystem;
  5. public class VuforiaLocation : MonoBehaviour {
  6. public Vector3 RGBPositionOffset = new Vector3(0,0f,0.05f);
  7. public Vector3 RGBRotationOffset;
  8. // Use this for initialization
  9. void Start() {
  10. StartCoroutine(InitARCamera());
  11. }
  12. IEnumerator InitARCamera() {
  13. while(true) {
  14. if(SvrManager.Instance.IsRunning) {
  15. transform.SetParent(SvrManager.Instance.head, false);
  16. if(Module_ShadowSystem.Instant != null) {
  17. if(Module_ShadowSystem.Instant.Device) {
  18. transform.localEulerAngles = -Module_ShadowSystem.Instant.Device.Current.RGBRotationOffset + RGBRotationOffset;
  19. transform.localPosition = -Module_ShadowSystem.Instant.Device.Current.RGBPositionOffset + RGBPositionOffset;
  20. } else {
  21. transform.localEulerAngles = RGBRotationOffset;
  22. transform.localPosition = RGBPositionOffset;
  23. }
  24. }
  25. yield break;
  26. }
  27. yield return null;
  28. }
  29. }
  30. // Update is called once per frame
  31. void Update() {
  32. //gameObject.transform.position = SvrManager.Instance.modifyPosition;
  33. //gameObject.transform.rotation = SvrManager.Instance.modifyOrientation;
  34. }
  35. }