VuforiaLocation.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using SC.XR.Unity;
  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(API_GSXR_Slam.SlamManager.IsRunning) {
  15. transform.SetParent(API_GSXR_Slam.SlamManager.head, false);
  16. if (API_Module_Device.Current != null) {
  17. transform.localEulerAngles = -API_Module_Device.Current.RGBRotationOffset + RGBRotationOffset;
  18. transform.localPosition = -API_Module_Device.Current.RGBPositionOffset + RGBPositionOffset;
  19. } else {
  20. transform.localEulerAngles = RGBRotationOffset;
  21. transform.localPosition = RGBPositionOffset;
  22. }
  23. yield break;
  24. }
  25. yield return null;
  26. }
  27. }
  28. // Update is called once per frame
  29. void Update() {
  30. //gameObject.transform.position = API_GSXR_Slam.SlamManager.modifyPosition;
  31. //gameObject.transform.rotation = API_GSXR_Slam.SlamManager.modifyOrientation;
  32. }
  33. }