Skip to content

Commit e71f2c6

Browse files
jloehrkeveleigh
andauthored
Fix simulated motion controller grab (#11272)
Raise boolean input events for simulated motion controller grab Co-authored-by: Kurtis <kurtie@microsoft.com>
1 parent 6ceb3b5 commit e71f2c6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Assets/MRTK/Core/Providers/InputSimulation/SimulatedMotionController.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,17 @@ internal void UpdateState(SimulatedMotionControllerData motionControllerData)
132132
break;
133133
case DeviceInputType.GripPress:
134134
case DeviceInputType.TriggerPress:
135-
Interactions[i].FloatData = motionControllerData.ButtonState.IsGrabbing ? 1 : 0;
135+
Interactions[i].BoolData = motionControllerData.ButtonState.IsGrabbing;
136136
if (Interactions[i].Changed)
137137
{
138-
CoreServices.InputSystem?.RaiseFloatInputChanged(InputSource, ControllerHandedness, Interactions[i].MixedRealityInputAction, motionControllerData.ButtonState.IsGrabbing ? 1 : 0);
138+
if (Interactions[i].BoolData)
139+
{
140+
CoreServices.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, Interactions[i].MixedRealityInputAction);
141+
}
142+
else
143+
{
144+
CoreServices.InputSystem?.RaiseOnInputUp(InputSource, ControllerHandedness, Interactions[i].MixedRealityInputAction);
145+
}
139146
}
140147
break;
141148
case DeviceInputType.Menu:

0 commit comments

Comments
 (0)