Contains all functionality related to a VR device.

Пример #1
0
        public static IntPtr GetNativePtr()
        {
            IntPtr result;

            VRDevice.INTERNAL_CALL_GetNativePtr(out result);
            return(result);
        }
        public override void OnDeactivated()
        {
            m_rightIndex = INVALID_DEVICE_INDEX;
            m_leftIndex  = INVALID_DEVICE_INDEX;

            RemoveAllValidNodes();
            XRDevice.SetTrackingSpaceType(m_prevTrackingSpace);
        }
Пример #3
0
 public static void DisableAutoVRCameraTracking(Camera camera, bool disabled)
 {
     if (camera == null)
     {
         throw new ArgumentNullException("camera");
     }
     VRDevice.DisableAutoVRCameraTrackingInternal(camera, disabled);
 }
        public override void OnActivated()
        {
            m_prevTrackingSpace = XRDevice.GetTrackingSpaceType();
            UpdateTrackingSpaceType();

            EnsureDeviceStateLength(16);
            m_index2nodeID       = new ulong[GetDeviceStateLength()];
            m_index2nodeValidity = new bool[GetDeviceStateLength()];
            m_index2nodeTouched  = new bool[GetDeviceStateLength()];
        }
        public override void OnDeactivated()
        {
            m_rightIndex = INVALID_DEVICE_INDEX;
            m_leftIndex  = INVALID_DEVICE_INDEX;

            RemoveAllValidNodes();
#pragma warning disable CS0618
            XRDevice.SetTrackingSpaceType(m_prevTrackingSpace);
#pragma warning restore CS0618
        }
Пример #6
0
        protected virtual void Update()
        {
            if (XRDevice.GetTrackingSpaceType() != TrackingSpaceType.RoomScale && forceRoomScaleTracking)
            {
                XRDevice.SetTrackingSpaceType(TrackingSpaceType.RoomScale);
            }

            if (XRDevice.GetTrackingSpaceType() != TrackingSpaceType.Stationary && !forceRoomScaleTracking)
            {
                XRDevice.SetTrackingSpaceType(TrackingSpaceType.Stationary);
            }
        }
        public override void OnActivated()
        {
#pragma warning disable CS0618
            m_prevTrackingSpace = XRDevice.GetTrackingSpaceType();
#pragma warning restore CS0618
            UpdateTrackingSpaceType();

            EnsureDeviceStateLength(16);
            m_index2nodeID       = new ulong[GetDeviceStateLength()];
            m_index2nodeValidity = new bool[GetDeviceStateLength()];
            m_index2nodeTouched  = new bool[GetDeviceStateLength()];
        }
        public override void UpdateTrackingSpaceType()
        {
            switch (VRModule.trackingSpaceType)
            {
            case VRModuleTrackingSpaceType.Stationary:
                XRDevice.SetTrackingSpaceType(TrackingSpaceType.Stationary);
                break;

            case VRModuleTrackingSpaceType.RoomScale:
                XRDevice.SetTrackingSpaceType(TrackingSpaceType.RoomScale);
                break;
            }
        }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.VR.VRDevice o;
         o=new UnityEngine.VR.VRDevice();
         pushValue(l,true);
         pushValue(l,o);
         return 2;
     }
     catch(Exception e) {
         return error(l,e);
     }
 }
Пример #10
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.VR.VRDevice o;
         o = new UnityEngine.VR.VRDevice();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.VR.VRDevice o;
         o=new UnityEngine.VR.VRDevice();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
        public override void UpdateTrackingSpaceType()
        {
#pragma warning disable CS0618
            switch (VRModule.trackingSpaceType)
            {
            case VRModuleTrackingSpaceType.Stationary:
                XRDevice.SetTrackingSpaceType(TrackingSpaceType.Stationary);
                break;

            case VRModuleTrackingSpaceType.RoomScale:
                var prev_trackingOrigin = XRDevice.trackingOriginMode;
                XRDevice.SetTrackingSpaceType(TrackingSpaceType.RoomScale);
                if (prev_trackingOrigin == XRDevice.trackingOriginMode)
                {
                    XRDevice.SetTrackingSpaceType(TrackingSpaceType.Stationary);
                }
                break;
            }
#pragma warning restore CS0618
        }
Пример #13
0
        public override void OnActivated()
        {
            m_prevTrackingSpace = XRDevice.GetTrackingSpaceType();
            UpdateTrackingSpaceType();

            EnsureDeviceStateLength(16);
            m_index2nodeID       = new ulong[GetDeviceStateLength()];
            m_index2nodeValidity = new bool[GetDeviceStateLength()];
            m_index2nodeTouched  = new bool[GetDeviceStateLength()];

            if (s_nodeType2DeviceClass == null)
            {
                s_nodeType2DeviceClass = new EnumArray <XRNode, VRModuleDeviceClass>(VRModuleDeviceClass.Invalid);
                s_nodeType2DeviceClass[XRNode.Head]              = VRModuleDeviceClass.HMD;
                s_nodeType2DeviceClass[XRNode.RightHand]         = VRModuleDeviceClass.Controller;
                s_nodeType2DeviceClass[XRNode.LeftHand]          = VRModuleDeviceClass.Controller;
                s_nodeType2DeviceClass[XRNode.GameController]    = VRModuleDeviceClass.Controller;
                s_nodeType2DeviceClass[XRNode.HardwareTracker]   = VRModuleDeviceClass.GenericTracker;
                s_nodeType2DeviceClass[XRNode.TrackingReference] = VRModuleDeviceClass.TrackingReference;
            }
        }
Пример #14
0
        public override void UpdateTrackingSpaceType()
        {
            switch (VRModule.trackingSpaceType)
            {
            case VRModuleTrackingSpaceType.Stationary:
                XRDevice.SetTrackingSpaceType(TrackingSpaceType.Stationary);
                break;

            case VRModuleTrackingSpaceType.RoomScale:
#if UNITY_2019_2_OR_NEWER && !UNITY_2019_3_OR_NEWER
                var prev_trackingOrigin = XRDevice.trackingOriginMode;
                XRDevice.SetTrackingSpaceType(TrackingSpaceType.RoomScale);
                if (prev_trackingOrigin == XRDevice.trackingOriginMode)
                {
                    XRDevice.SetTrackingSpaceType(TrackingSpaceType.Stationary);
                }
#else
                XRDevice.SetTrackingSpaceType(TrackingSpaceType.RoomScale);
#endif
                break;
            }
        }
 public override void OnDeactivated()
 {
     XRDevice.SetTrackingSpaceType(m_prevTrackingSpace);
 }
 public override void OnActivated()
 {
     m_prevTrackingSpace = XRDevice.GetTrackingSpaceType();
     UpdateTrackingSpaceType();
 }