IEnumerator Start() { #if UNITY_ANDROID && !UNITY_EDITOR MirageAR_ServiceHelper.InitMirageARService(); //Wait the MirageAR Service Connected Succeed if (!MirageAR_ServiceHelper.mMirageARServiceConnected) { //Wait until Android Service Init Complete yield return(new WaitUntil(() => MirageAR_ServiceHelper.mMirageARServiceConnected)); } #elif UNITY_IOS && !UNITY_EDITOR //TODO:The URLScheme callback will later than Unity Init Event,So Wait a While yield return(new WaitForSeconds(0.2f)); #endif if (mIs2DMode) { VisionSDK.Instance.Init(true, mMirageARLogger != null ? mMirageARLogger : null); // Add a controller mControllerPeripheral = new ControllerPeripheral("XCobra-0"); VisionSDK.Instance.Connections.AddPeripheral(mControllerPeripheral); } else { VisionSDK.Instance.Init(false, mMirageARLogger != null ? mMirageARLogger : null); // Init Self Define Devices Setting Init_Setting(); // Enable Mag Correction, it defaults off. VisionSDK.Instance.StereoCamera.UseMagnetometerCorrection = false; // If you want to use prediction for the HMD (Phone). VisionSDK.Instance.Tracking.Hmd.UsePositionPrediction = true; VisionSDK.Instance.Tracking.Hmd.UseRotationPrediction = true; //create controllerPeripheral mControllerPeripheral = new ControllerPeripheral("XCobra-0"); mControllerPeripheral.UsePositionPrediction = true; VisionSDK.Instance.Connections.AddPeripheral(mControllerPeripheral); // Button Home Events Bind mInputListener = MirageAR_InputListener.Instance; if (mInputListener != null) { mInputListener.HomePressDown += MInputListener_HomePressDown; mInputListener.HomePressUp += MInputListener_HomePressUp; } VisionSDK.Instance.Connections.OnPeripheralStateChange += OnPeripheralStateChange; } yield return(null); }
public void onServiceDisconnected() { Debug.Log("onServiceDisconnected"); MirageAR_ServiceHelper.MirageServiceDisconnected(); }
public void onServiceConnected(int hwInitReturn) { Debug.Log("onServiceConnected"); MirageAR_ServiceHelper.MirageARServiceConnected(); }