From e71f2c694d83d2580b35b3f15e819e5e2996c674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20L=C3=B6hr?= Date: Tue, 6 Dec 2022 19:07:02 +0100 Subject: [PATCH] Fix simulated motion controller grab (#11272) Raise boolean input events for simulated motion controller grab Co-authored-by: Kurtis --- .../InputSimulation/SimulatedMotionController.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Assets/MRTK/Core/Providers/InputSimulation/SimulatedMotionController.cs b/Assets/MRTK/Core/Providers/InputSimulation/SimulatedMotionController.cs index 92470deec9c..e9b13778e47 100644 --- a/Assets/MRTK/Core/Providers/InputSimulation/SimulatedMotionController.cs +++ b/Assets/MRTK/Core/Providers/InputSimulation/SimulatedMotionController.cs @@ -132,10 +132,17 @@ internal void UpdateState(SimulatedMotionControllerData motionControllerData) break; case DeviceInputType.GripPress: case DeviceInputType.TriggerPress: - Interactions[i].FloatData = motionControllerData.ButtonState.IsGrabbing ? 1 : 0; + Interactions[i].BoolData = motionControllerData.ButtonState.IsGrabbing; if (Interactions[i].Changed) { - CoreServices.InputSystem?.RaiseFloatInputChanged(InputSource, ControllerHandedness, Interactions[i].MixedRealityInputAction, motionControllerData.ButtonState.IsGrabbing ? 1 : 0); + if (Interactions[i].BoolData) + { + CoreServices.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, Interactions[i].MixedRealityInputAction); + } + else + { + CoreServices.InputSystem?.RaiseOnInputUp(InputSource, ControllerHandedness, Interactions[i].MixedRealityInputAction); + } } break; case DeviceInputType.Menu: