|
@@ -2,6 +2,11 @@ using Immersal.AR;
|
|
|
using UnityEngine;
|
|
|
using Blue;
|
|
|
using UnityEngine.UI;
|
|
|
+using Immersal;
|
|
|
+using System.Collections;
|
|
|
+using NRKernal;
|
|
|
+using XRTool.Util;
|
|
|
+using static IsLocation;
|
|
|
|
|
|
|
|
|
|
|
@@ -39,9 +44,9 @@ public class ImmersalLocalControl : AbstractController
|
|
|
if(isOn)
|
|
|
{
|
|
|
|
|
|
- Y_Location_Toggle.isOn = true;
|
|
|
+
|
|
|
XRLocalizer.enabled = true;
|
|
|
-
|
|
|
+ StartCoroutine(StartNewLocalize());
|
|
|
Y_Location_Toggle.transform.Find("Background").GetComponent<Image>().color = blue;
|
|
|
Y_Location_Toggle.transform.Find("Background/Checkmark").GetComponent<Image>().color = blue;
|
|
|
N_Location_Toggle.transform.Find("Background").GetComponent<Image>().color = white;
|
|
@@ -70,4 +75,30 @@ public class ImmersalLocalControl : AbstractController
|
|
|
isOn = e.isLocation;
|
|
|
this.SendCommand(new ImmersalSetLocalCommand(id,projectId,isOn));
|
|
|
}
|
|
|
+
|
|
|
+ IEnumerator StartNewLocalize()
|
|
|
+ {
|
|
|
+ yield return null;
|
|
|
+ Ref();
|
|
|
+ this.SendCommand(new SetImmersalLocalCommand(true));
|
|
|
+ }
|
|
|
+ public void Ref()
|
|
|
+ {
|
|
|
+ ImmersalSDK.Instance.Localizer.Reset();
|
|
|
+ NRSessionManager.Instance.NRHMDPoseTracker.ChangeTo0Dof((result) =>
|
|
|
+ {
|
|
|
+ TimerMgr.Instance.CreateTimer(() => {
|
|
|
+
|
|
|
+ NRSessionManager.Instance.NRHMDPoseTracker.ChangeTo6Dof((result) =>
|
|
|
+ {
|
|
|
+ var poseTracker = NRSessionManager.Instance.NRHMDPoseTracker;
|
|
|
+ poseTracker.ResetWorldMatrix(false);
|
|
|
+ ImmersalSDK.Instance.Localizer.Reset();
|
|
|
+ NRInput.RecenterController();
|
|
|
+ SetLocalTime.isActive = true;
|
|
|
+ });
|
|
|
+
|
|
|
+ }, 1f);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|