示例#1
0
        private void InputTracking_nodeAdded(TrackingAnchor anchor, ref XRNodeState xRNodeState)
        {
            if (anchor == null || anchor.connected)
            {
                return;
            }
            InputDevice inputDevice = U3DInputDevices.GetDeviceAtXRNode(xRNodeState.nodeType);

            anchor.Connected(xRNodeState.uniqueID, inputDevice.name);
            InputDevices.OnTrackerConnected(anchor);
        }
示例#2
0
 public void StopHaptics()
 {
     InputDevices.StopHaptics(m_DeviceId);
 }
示例#3
0
 public bool TryGetHapticCapabilities(out HapticCapabilities capabilities)
 {
     return(InputDevices.TryGetHapticCapabilities(m_DeviceId, out capabilities));
 }
        public bool SendHapticBuffer(uint channel, byte[] buffer)
        {
            bool flag = !this.IsValidId();

            return(!flag && InputDevices.SendHapticBuffer(this.m_DeviceId, channel, buffer));
        }
示例#5
0
 public bool TryGetFeatureValue(InputFeatureUsage <Eyes> usage, out Eyes value)
 {
     return(InputDevices.TryGetFeatureValue_XREyes(m_DeviceId, usage.name, out value));
 }
示例#6
0
 public bool TryGetFeatureValue(InputFeatureUsage <Hand> usage, out Hand value)
 {
     return(InputDevices.TryGetFeatureValue_XRHand(m_DeviceId, usage.name, out value));
 }
示例#7
0
 public bool TryGetFeatureValue(InputFeatureUsage <Vector3> usage, out Vector3 value)
 {
     return(InputDevices.TryGetFeatureValue_Vector3f(m_DeviceId, usage.name, out value));
 }
示例#8
0
 public bool TryGetFeatureValue(InputFeatureUsage <uint> usage, out uint value)
 {
     return(InputDevices.TryGetFeatureValue_UInt32(m_DeviceId, usage.name, out value));
 }
        public bool TryGetFeatureValue(InputFeatureUsage <byte[]> usage, byte[] value)
        {
            bool flag = this.IsValidId();

            return(flag && InputDevices.TryGetFeatureValue_Custom(this.m_DeviceId, usage.name, value));
        }
        public bool TryGetFeatureValue(InputFeatureUsage <Eyes> usage, out Eyes value)
        {
            bool flag = this.CheckValidAndSetDefault <Eyes>(out value);

            return(flag && InputDevices.TryGetFeatureValue_XREyes(this.m_DeviceId, usage.name, out value));
        }
        public bool TryGetFeatureValue(InputFeatureUsage <Quaternion> usage, out Quaternion value)
        {
            bool flag = this.CheckValidAndSetDefault <Quaternion>(out value);

            return(flag && InputDevices.TryGetFeatureValue_Quaternionf(this.m_DeviceId, usage.name, out value));
        }
        public bool TryGetFeatureValue(InputFeatureUsage <Vector3> usage, out Vector3 value)
        {
            bool flag = this.CheckValidAndSetDefault <Vector3>(out value);

            return(flag && InputDevices.TryGetFeatureValue_Vector3f(this.m_DeviceId, usage.name, out value));
        }
        public bool TryGetFeatureValue(InputFeatureUsage <float> usage, out float value)
        {
            bool flag = this.CheckValidAndSetDefault <float>(out value);

            return(flag && InputDevices.TryGetFeatureValue_float(this.m_DeviceId, usage.name, out value));
        }
        public bool TryGetFeatureUsages(List <InputFeatureUsage> featureUsages)
        {
            bool flag = this.IsValidId();

            return(flag && InputDevices.TryGetFeatureUsages(this.m_DeviceId, featureUsages));
        }
        public bool TryGetHapticCapabilities(out HapticCapabilities capabilities)
        {
            bool flag = this.CheckValidAndSetDefault <HapticCapabilities>(out capabilities);

            return(flag && InputDevices.TryGetHapticCapabilities(this.m_DeviceId, out capabilities));
        }
示例#16
0
 // Feature Usages
 public bool TryGetFeatureUsages(List <InputFeatureUsage> featureUsages)
 {
     return(InputDevices.TryGetFeatureUsages(m_DeviceId, featureUsages));
 }
示例#17
0
 // Features
 public bool TryGetFeatureValue(InputFeatureUsage <bool> usage, out bool value)
 {
     return(InputDevices.TryGetFeatureValue_bool(m_DeviceId, usage.name, out value));
 }
        public bool TryGetFeatureValue(InputFeatureUsage <Quaternion> usage, DateTime time, out Quaternion value)
        {
            bool flag = this.CheckValidAndSetDefault <Quaternion>(out value);

            return(flag && InputDevices.TryGetFeatureValueAtTime_Quaternionf(this.m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value));
        }
示例#19
0
 public bool TryGetFeatureValue(InputFeatureUsage <float> usage, out float value)
 {
     return(InputDevices.TryGetFeatureValue_float(m_DeviceId, usage.name, out value));
 }
    protected override void FillMetadata(HandAnchor anchor, ref XRNodeState xRNode)
    {
        var   device = U3DInputDevices.GetDeviceAtXRNode(xRNode.nodeType);
        float thumb = 0f, index = 0f, middle = 0f;

        //psotion && rotation
        xRNode.TryGetPosition(out anchor.position);
        xRNode.TryGetRotation(out anchor.rotation);

        OVRInput.Controller touch = OVRInput.Controller.LTouch;
        if (anchor.type == NodeType.RightHand)
        {
            touch = OVRInput.Controller.RTouch;
        }

        //grip
        anchor.gripTouchValue = OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger, touch);
        anchor.gripPressed    = OVRInput.Get(OVRInput.Button.PrimaryHandTrigger, touch);
        middle = anchor.gripTouchValue;

        //trigger
        anchor.triggerTouchValue = OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger, touch);
        anchor.triggerPressed    = OVRInput.Get(OVRInput.Button.PrimaryIndexTrigger, touch);
        index = anchor.triggerTouchValue;

        //system
        device.TryGetFeatureValue(CommonUsages.menuButton, out anchor.systemPressed);
        anchor.systemTouchValue = 0f;
        if (anchor.systemPressed)
        {
            anchor.systemTouchValue = 1f;
        }
        thumb = Mathf.Max(thumb, anchor.systemTouchValue);

        //primary
        anchor.primaryPressed    = OVRInput.Get(OVRInput.Button.One, touch);
        anchor.primaryTouch      = OVRInput.Get(OVRInput.Touch.One, touch);
        anchor.primaryTouchValue = 0f;
        if (anchor.primaryTouch)
        {
            anchor.primaryTouchValue = 0.5f;
        }
        if (anchor.primaryPressed)
        {
            anchor.primaryTouchValue = 1.0f;
        }
        thumb = Mathf.Max(thumb, anchor.primaryTouchValue);

        //secondary
        anchor.secondaryPressed    = OVRInput.Get(OVRInput.Button.Two, touch);
        anchor.secondaryTouch      = OVRInput.Get(OVRInput.Touch.Two, touch);
        anchor.secondaryTouchValue = 0f;
        if (anchor.secondaryTouch)
        {
            anchor.secondaryTouchValue = 0.5f;
        }
        if (anchor.secondaryPressed)
        {
            anchor.secondaryTouchValue = 1.0f;
        }
        thumb = Mathf.Max(thumb, anchor.secondaryTouchValue);

        //primary2DAxis
        anchor.primary2DAxis        = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, touch);
        anchor.primary2DAxisPressed = OVRInput.Get(OVRInput.Button.PrimaryThumbstick, touch);
        anchor.primary2DAxisTouch   = OVRInput.Get(OVRInput.Touch.PrimaryThumbstick, touch);
        thumb = Mathf.Max(thumb, (anchor.primary2DAxisPressed || anchor.primary2DAxisTouch) ? 1f : 0f);
        thumb = Mathf.Max(thumb, anchor.primary2DAxis.sqrMagnitude > 0.1f ? 1f : 0f);

        //secondary2DAxis
        anchor.secondary2DAxis = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick, touch);
        thumb = Mathf.Max(thumb, anchor.secondary2DAxis.sqrMagnitude > 0.1f ? 1f : 0f);
        thumb = thumb > 0.06f ? thumb : 0;

        //fingers
        anchor.fingerCurls[0]  = thumb;
        anchor.fingerCurls[1]  = index;
        anchor.fingerCurls[2]  = middle;
        anchor.fingerCurls[3]  = middle;
        anchor.fingerCurls[4]  = middle;
        anchor.handPoseChanged = true;
    }
示例#21
0
 public bool TryGetFeatureValue(InputFeatureUsage <Quaternion> usage, out Quaternion value)
 {
     return(InputDevices.TryGetFeatureValue_Quaternionf(m_DeviceId, usage.name, out value));
 }
 public bool TryGetFeatureValue(InputFeatureUsage <byte[]> usage, byte[] value)
 {
     return(InputDevices.TryGetFeatureValue_Custom(m_DeviceId, usage.name, value));
 }
示例#23
0
 public bool TryGetFeatureValue(InputFeatureUsage <Bone> usage, out Bone value)
 {
     return(InputDevices.TryGetFeatureValue_XRBone(m_DeviceId, usage.name, out value));
 }
示例#24
0
 public bool SendHapticBuffer(uint channel, byte[] buffer)
 {
     return(InputDevices.SendHapticBuffer(m_DeviceId, channel, buffer));
 }
示例#25
0
 public bool TryGetFeatureValue(InputFeatureUsage <Quaternion> usage, DateTime time, out Quaternion value)
 {
     return(InputDevices.TryGetFeatureValueAtTime_Quaternionf(m_DeviceId, usage.name, TimeConverter.LocalDateTimeToUnixTimeMilliseconds(time), out value));
 }
示例#26
0
        protected override void FillMetadata(HandAnchor anchor, ref XRNodeState xRNode)
        {
            var   device = U3DInputDevices.GetDeviceAtXRNode(xRNode.nodeType);
            float thumb = 0f, index = 0f, middle = 0f;

            //psotion && rotation
            xRNode.TryGetPosition(out anchor.position);
            xRNode.TryGetRotation(out anchor.rotation);

            //grip
            device.TryGetFeatureValue(CommonUsages.gripButton, out anchor.gripPressed);
            device.TryGetFeatureValue(CommonUsages.grip, out anchor.gripTouchValue);
            anchor.gripTouchValue = anchor.gripTouchValue > 0.06f ? anchor.gripTouchValue : 0f;
            middle = anchor.gripTouchValue;

            //trigger
            device.TryGetFeatureValue(CommonUsages.triggerButton, out anchor.triggerPressed);
            device.TryGetFeatureValue(CommonUsages.trigger, out anchor.triggerTouchValue);
            anchor.triggerTouchValue = anchor.triggerTouchValue > 0.06f ? anchor.triggerTouchValue : 0f;
            index = anchor.triggerTouchValue;

            //system
            device.TryGetFeatureValue(CommonUsages.menuButton, out anchor.systemPressed);
            anchor.systemTouchValue = 0f;
            if (anchor.systemPressed)
            {
                anchor.systemTouchValue = 1f;
            }
            thumb = Mathf.Max(thumb, anchor.systemTouchValue);

            //primary
            device.TryGetFeatureValue(CommonUsages.primaryButton, out anchor.primaryPressed);
            bool primaryTouch = false;

            device.TryGetFeatureValue(CommonUsages.primaryTouch, out primaryTouch);
            anchor.primaryTouchValue = (anchor.primaryPressed || primaryTouch) ? 1f : 0f;
            thumb = Mathf.Max(thumb, anchor.primaryTouchValue);

            //secondary
            device.TryGetFeatureValue(CommonUsages.secondaryButton, out anchor.secondaryPressed);
            bool secondaryTouch = false;

            device.TryGetFeatureValue(CommonUsages.secondaryTouch, out secondaryTouch);
            anchor.secondaryTouchValue = (anchor.secondaryPressed || secondaryTouch) ? 1f : 0f;
            thumb = Mathf.Max(thumb, anchor.secondaryTouchValue);

            //primary2DAxis
            device.TryGetFeatureValue(CommonUsages.primary2DAxisTouch, out anchor.primary2DAxisTouch);
            device.TryGetFeatureValue(CommonUsages.primary2DAxisClick, out anchor.primary2DAxisPressed);
            device.TryGetFeatureValue(CommonUsages.primary2DAxis, out anchor.primary2DAxis);
            thumb = Mathf.Max(thumb, (anchor.primary2DAxisPressed || anchor.primary2DAxisTouch) ? 1f : 0f);
            thumb = Mathf.Max(thumb, anchor.primary2DAxis.sqrMagnitude > 0.1f ? 1f : 0f);

            //secondary2DAxis
            device.TryGetFeatureValue(CommonUsages.secondary2DAxis, out anchor.secondary2DAxis);
            thumb = Mathf.Max(thumb, anchor.secondary2DAxis.sqrMagnitude > 0.1f ? 1f : 0f);
            thumb = thumb > 0.06f ? thumb: 0;

            //fingers
            anchor.fingerCurls[0]  = thumb;
            anchor.fingerCurls[1]  = index;
            anchor.fingerCurls[2]  = middle;
            anchor.fingerCurls[3]  = middle;
            anchor.fingerCurls[4]  = middle;
            anchor.handPoseChanged = true;
        }