diff --git a/XRTK-Core/Packages/com.xrtk.core/Providers/Controllers/UnityInput/GenericJoystickController.cs b/XRTK-Core/Packages/com.xrtk.core/Providers/Controllers/UnityInput/GenericJoystickController.cs index f4316877d..19cb00109 100644 --- a/XRTK-Core/Packages/com.xrtk.core/Providers/Controllers/UnityInput/GenericJoystickController.cs +++ b/XRTK-Core/Packages/com.xrtk.core/Providers/Controllers/UnityInput/GenericJoystickController.cs @@ -89,7 +89,7 @@ protected void UpdateButtonData(MixedRealityInteractionMapping interactionMappin switch (interactionMapping.InputType) { case DeviceInputType.TriggerPress: - interactionMapping.BoolData = Input.GetAxis(interactionMapping.AxisCodeX).Equals(1); + interactionMapping.BoolData = Input.GetAxisRaw(interactionMapping.AxisCodeX).Equals(1); break; case DeviceInputType.TriggerNearTouch: case DeviceInputType.ThumbNearTouch: @@ -97,7 +97,7 @@ protected void UpdateButtonData(MixedRealityInteractionMapping interactionMappin case DeviceInputType.MiddleFingerNearTouch: case DeviceInputType.RingFingerNearTouch: case DeviceInputType.PinkyFingerNearTouch: - interactionMapping.BoolData = !Input.GetAxis(interactionMapping.AxisCodeX).Equals(0); + interactionMapping.BoolData = !Input.GetAxisRaw(interactionMapping.AxisCodeX).Equals(0); break; default: interactionMapping.BoolData = Input.GetKey(interactionMapping.KeyCode); @@ -107,7 +107,7 @@ protected void UpdateButtonData(MixedRealityInteractionMapping interactionMappin // If our value changed raise it. if (interactionMapping.Changed) { - // Raise input system Event if it enabled + // Raise input system Event if it is enabled if (interactionMapping.BoolData) { MixedRealityToolkit.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction); @@ -136,22 +136,38 @@ protected void UpdateSingleAxisData(MixedRealityInteractionMapping interactionMa { Debug.Assert(interactionMapping.AxisType == AxisType.SingleAxis); - var singleAxisValue = Input.GetAxis(interactionMapping.AxisCodeX); + var singleAxisValue = Input.GetAxisRaw(interactionMapping.AxisCodeX); - // Update the interaction data source - interactionMapping.FloatData = singleAxisValue; - - // If our value was updated, raise it. - if (interactionMapping.Updated) + if (interactionMapping.InputType == DeviceInputType.TriggerPress) { - // Raise input system Event if it enabled - MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.FloatData); - } + // Update the interaction data source + interactionMapping.BoolData = singleAxisValue.Equals(1); - // If our value was updated, raise it. - if (interactionMapping.Updated) + // If our value changed raise it. + if (interactionMapping.Changed) + { + // Raise input system Event if it is enabled + if (interactionMapping.BoolData) + { + MixedRealityToolkit.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction); + } + else + { + MixedRealityToolkit.InputSystem?.RaiseOnInputUp(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction); + } + } + } + else { - MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, singleAxisValue); + // Update the interaction data source + interactionMapping.FloatData = singleAxisValue; + + // If our value was updated, raise it. + if (interactionMapping.Updated) + { + // Raise input system Event if it is enabled + MixedRealityToolkit.InputSystem?.RaiseOnInputPressed(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.FloatData); + } } } @@ -172,7 +188,7 @@ protected void UpdateDualAxisData(MixedRealityInteractionMapping interactionMapp // If our value was updated, raise it. if (interactionMapping.Updated) { - // Raise input system Event if it enabled + // Raise input system Event if it is enabled MixedRealityToolkit.InputSystem?.RaisePositionInputChanged(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.Vector2Data); } } @@ -207,7 +223,7 @@ protected void UpdatePoseData(MixedRealityInteractionMapping interactionMapping) // If our value was updated, raise it. if (interactionMapping.Updated) { - // Raise input system Event if it enabled + // Raise input system Event if it is enabled MixedRealityToolkit.InputSystem?.RaisePoseInputChanged(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, interactionMapping.PoseData); } }