Exemple #1
0
        public bool GetButon(XR_Enum.FeatureUsageButton featureUsage, XR_Enum.Hand hand)
        {
            XR_Controller controller = GetHandController(hand);

            if (controller == null)
            {
                return(false);
            }

            switch (featureUsage)
            {
            case XR_Enum.FeatureUsageButton.PrimaryButton: return(controller.IsPrimaryPressed);

            case XR_Enum.FeatureUsageButton.PrimaryTouch: return(controller.IsPrimaryTouched);

            case XR_Enum.FeatureUsageButton.SecondaryButton: return(controller.IsSecondaryPressed);

            case XR_Enum.FeatureUsageButton.SecondaryTouch: return(controller.IsSecondaryTouched);

            case XR_Enum.FeatureUsageButton.GripButton: return(controller.IsGripPressed);

            case XR_Enum.FeatureUsageButton.TriggerButton: return(controller.IsTriggerPressed);

            case XR_Enum.FeatureUsageButton.MenuButton: return(controller.IsMenuPressed);

            case XR_Enum.FeatureUsageButton.Primary2DAxisClick: return(controller.IsPrimary2DAxisPressed);

            case XR_Enum.FeatureUsageButton.Primary2DAxisTouch: return(controller.IsPrimary2DAxisTouch);

            case XR_Enum.FeatureUsageButton.Thumbrest: return(controller.IsThumbrestPressed);

            default: return(false);
            }
        }
Exemple #2
0
        public float GetAxis(XR_Enum.FeatureUsageAxis featureUsage, XR_Enum.Hand hand)
        {
            XR_Controller controller = GetHandController(hand);

            if (controller == null)
            {
                return(0);
            }

            switch (featureUsage)
            {
            case XR_Enum.FeatureUsageAxis.Trigger: return(controller.TriggerValue);

            case XR_Enum.FeatureUsageAxis.Grip: return(controller.GripValue);

            case XR_Enum.FeatureUsageAxis.IndexTouch: return(controller.IndexTouchValue);

            case XR_Enum.FeatureUsageAxis.ThumbTouch: return(controller.ThumbTouchValue);

            case XR_Enum.FeatureUsageAxis.IndexFinger: return(controller.IndexFingerValue);

            case XR_Enum.FeatureUsageAxis.MiddleFinger: return(controller.MiddleFingerValue);

            case XR_Enum.FeatureUsageAxis.RingFinger: return(controller.RingFingerValue);

            case XR_Enum.FeatureUsageAxis.PinkyFinger: return(controller.PinkyFingerValue);

            case XR_Enum.FeatureUsageAxis.CombinedTrigger: return(controller.CombinedTriggerValue);

            default: return(0);
            }
        }
Exemple #3
0
        internal void AddNewInputDevice(InputDevice device)
        {
            GameObject    node       = new GameObject();
            XR_Controller controller = node.AddComponent <XR_Controller>();

            controller.InitInputDevice(device);
            handControllers.Add(controller);
        }
Exemple #4
0
        public Vector2 GetAxis2D(XR_Enum.FeatureUsage2DAxis featureUsage, XR_Enum.Hand hand)
        {
            XR_Controller controller = GetHandController(hand);

            if (controller == null)
            {
                return(Vector2.zero);
            }

            switch (featureUsage)
            {
            case XR_Enum.FeatureUsage2DAxis.Primary2DAxis: return(controller.GetPrimary2DAxisValue);

            case XR_Enum.FeatureUsage2DAxis.Secondary2DAxis: return(controller.GetSecondary2DAxisValue);

            default: return(Vector2.zero);
            }
        }
Exemple #5
0
        public XR_Controller GetHandController(XR_Enum.Hand hand)
        {
            XR_Controller controller = handControllers.Find(obj => obj.HandType == hand);

            return(controller);
        }