Esempio n. 1
0
        private void Update()
        {
#if UNITY_2017_2_OR_NEWER
            if (XRDevice.isPresent)
#else
            if (VRDevice.isPresent)
#endif
            {
                if (VRInfo.IsVRModelOculus())
                {
                    bool sensor1 = TrackedDeviceManager.Instance.IsSensorAvailable(0);
                    bool sensor2 = TrackedDeviceManager.Instance.IsSensorAvailable(1);
                    if (!sensor1 || !sensor2)
                    {
                        var popUpWindow = GetComponent <GameObjects.OpenPopupWindow>();

                        if (!popUpWindow)
                        {
                            return;
                        }

                        popUpWindow.Open();
                    }
                }
                Destroy(this.gameObject);
            }
        }
        void SensorCheck()
        {
#if UNITY_2017_2_OR_NEWER
            if (XRDevice.isPresent && VRInfo.IsVRModelOculus())
#else
            if (VRDevice.isPresent && VRInfo.IsVRModelOculus())
#endif
            {
                Vector3    newPos;
                Quaternion newRot;

                var oldSensorPose = MixCast.Settings.sensorPose;

                var index = MixCast.Settings.sensorIndex;
                if (TrackedDeviceManager.Instance.GetSensorPosition(index, out newPos, out newRot))
                {
                    if (newPos != Vector3.zero || newRot != Quaternion.identity)
                    {
                        if (WasSensorDifferent(oldSensorPose, newPos, newRot))
                        {
                            SetTransformFromOldPoseToNewPose(oldSensorPose, newPos, newRot);

                            if (VRInfo.IsDeviceOpenVR())
                            {
                                Debug.Log(SPACE_CHANGE_WARNING);
                                MixCast.Settings.sensorPose = new MixCastData.SensorPose()
                                {
                                    position = newPos, rotation = newRot
                                };
                            }
                        }
                    }
                }
            }
        }