예제 #1
0
        void HideFeedback(VRInputDevice.VRControl control)
        {
            ProxyFeedbackRequest request;

            if (m_FeedbackRequests.TryGetValue(control, out request))
            {
                m_FeedbackRequests.Remove(control);
                this.RemoveFeedbackRequest(request);
            }
        }
예제 #2
0
        void HideFeedback(VRInputDevice.VRControl control)
        {
            var key = (int)control;
            ProxyFeedbackRequest request;

            if (m_FeedbackRequests.TryGetValue(key, out request))
            {
                m_FeedbackRequests.Remove(key);
                this.RemoveFeedbackRequest(request);
            }
        }
예제 #3
0
        bool GetAxis(VRInputDevice.Handedness hand, VRInputDevice.VRControl axis, out float value)
        {
            switch (axis)
            {
            case VRInputDevice.VRControl.Trigger1:
                if (hand == VRInputDevice.Handedness.Left)
                {
                    value = UnityEngine.Input.GetAxis("XRI_Left_Trigger");
                }
                else
                {
                    value = UnityEngine.Input.GetAxis("XRI_Right_Trigger");
                }
                return(true);

            case VRInputDevice.VRControl.Trigger2:
                if (hand == VRInputDevice.Handedness.Left)
                {
                    value = UnityEngine.Input.GetAxis("XRI_Left_Grip");
                }
                else
                {
                    value = UnityEngine.Input.GetAxis("XRI_Right_Grip");
                }
                return(true);

            case VRInputDevice.VRControl.LeftStickX:
                if (hand == VRInputDevice.Handedness.Left)
                {
                    value = UnityEngine.Input.GetAxis("XRI_Left_Primary2DAxis_Horizontal");
                }
                else
                {
                    value = UnityEngine.Input.GetAxis("XRI_Right_Primary2DAxis_Horizontal");
                }
                return(true);

            case VRInputDevice.VRControl.LeftStickY:
                if (hand == VRInputDevice.Handedness.Left)
                {
                    value = -1f * UnityEngine.Input.GetAxis("XRI_Left_Primary2DAxis_Vertical");
                }
                else
                {
                    value = -1f * UnityEngine.Input.GetAxis("XRI_Right_Primary2DAxis_Vertical");
                }
                return(true);
            }

            value = 0f;
            return(false);
        }
예제 #4
0
    private float GetAxis(OVRInput.Controller controller, VRInputDevice.VRControl axis)
    {
        switch (axis)
        {
        case VRInputDevice.VRControl.Trigger1:
            return(OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger, controller));

        case VRInputDevice.VRControl.LeftStickX:
            return(OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, controller).x);

        case VRInputDevice.VRControl.LeftStickY:
            return(OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, controller).y);
        }

        return(0f);
    }
예제 #5
0
        void ShowFeedback(VRInputDevice.VRControl control)
        {
            var key = (int)control;

            if (m_FeedbackRequests.ContainsKey(key))
            {
                return;
            }

            var request = (ProxyFeedbackRequest)this.GetFeedbackRequestObject(typeof(ProxyFeedbackRequest));

            request.control         = control;
            request.node            = node;
            request.duration        = -1;
            m_FeedbackRequests[key] = request;
            this.AddFeedbackRequest(request);
        }
예제 #6
0
        void ShowFeedback(VRInputDevice.VRControl control)
        {
            if (m_FeedbackRequests.ContainsKey(control))
            {
                return;
            }

            var request = new ProxyFeedbackRequest
            {
                control  = control,
                node     = node,
                duration = -1
            };

            m_FeedbackRequests[control] = request;
            this.AddFeedbackRequest(request);
        }
예제 #7
0
        private float GetAxis(int deviceIndex, VRInputDevice.VRControl axis)
        {
            var controller = SixenseInput.Controllers[deviceIndex];

            if (controller != null)
            {
                switch (axis)
                {
                case VRInputDevice.VRControl.Trigger1:
                    return(controller.Trigger);

                case VRInputDevice.VRControl.LeftStickX:
                    return(controller.JoystickX);

                case VRInputDevice.VRControl.LeftStickY:
                    return(controller.JoystickY);
                }
            }

            return(0f);
        }
예제 #8
0
        protected override string GetButtonAxis(VRInputDevice.Handedness hand, VRInputDevice.VRControl button)
        {
            // For some reason primary/secondary are swapped in OpenVR
            switch (button)
            {
            case VRInputDevice.VRControl.Action1:
                if (hand == VRInputDevice.Handedness.Left)
                {
                    return("XRI_Left_SecondaryButton");
                }
                else
                {
                    return("XRI_Right_SecondaryButton");
                }

            case VRInputDevice.VRControl.Action2:
                if (hand == VRInputDevice.Handedness.Left)
                {
                    return("XRI_Left_PrimaryButton");
                }
                else
                {
                    return("XRI_Right_PrimaryButton");
                }

            case VRInputDevice.VRControl.LeftStickButton:
                if (hand == VRInputDevice.Handedness.Left)
                {
                    return("XRI_Left_Primary2DAxisClick");
                }
                else
                {
                    return("XRI_Right_Primary2DAxisClick");
                }
            }

            // Not all buttons are currently mapped
            return(null);
        }
예제 #9
0
        protected virtual string GetButtonAxis(VRInputDevice.Handedness hand, VRInputDevice.VRControl button)
        {
            switch (button)
            {
            case VRInputDevice.VRControl.Action1:
                if (hand == VRInputDevice.Handedness.Left)
                {
                    return("XRI_Left_PrimaryButton");
                }
                else
                {
                    return("XRI_Right_PrimaryButton");
                }

            case VRInputDevice.VRControl.Action2:
                if (hand == VRInputDevice.Handedness.Left)
                {
                    return("XRI_Left_SecondaryButton");
                }
                else
                {
                    return("XRI_Right_SecondaryButton");
                }

            case VRInputDevice.VRControl.LeftStickButton:
                if (hand == VRInputDevice.Handedness.Left)
                {
                    return("XRI_Left_Primary2DAxisClick");
                }
                else
                {
                    return("XRI_Right_Primary2DAxisClick");
                }
            }

            // Not all buttons are currently mapped
            return(null);
        }
예제 #10
0
        private bool GetAxis(OVRInput.Controller controller, VRInputDevice.VRControl axis, out float value)
        {
            switch (axis)
            {
            case VRInputDevice.VRControl.Trigger1:
                value = OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger, controller);
                return(true);

            case VRInputDevice.VRControl.Trigger2:
                value = OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger, controller);
                return(true);

            case VRInputDevice.VRControl.LeftStickX:
                value = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, controller).x;
                return(true);

            case VRInputDevice.VRControl.LeftStickY:
                value = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick, controller).y;
                return(true);
            }

            value = 0f;
            return(false);
        }
예제 #11
0
 public void UpdateValues(ProxyFeedbackRequest request)
 {
     m_Control     = request.control;
     m_TooltipText = request.tooltipText;
 }