Skip to content

Commit c3c7a8d

Browse files
committed
Fix air-tap in Holographic Remoting (workaround for Unity issue #1033526)
1 parent 234996a commit c3c7a8d

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/WindowsMixedRealityController.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,35 @@ private void UpdateTriggerData(InteractionSourceState interactionSourceState, Mi
414414
break;
415415
case DeviceInputType.Select:
416416
{
417+
bool selectPressed = interactionSourceState.selectPressed;
418+
419+
// BEGIN WORKAROUND: Unity issue #1033526
420+
// See https://issuetracker.unity3d.com/issues/hololens-interactionsourcestate-dot-selectpressed-is-false-when-air-tap-and-hold
421+
// Bug was discovered May 2018 and still exists as of today Feb 2019 in version 2018.3.4f1, timeline for fix unknown
422+
// The bug only and the workaround affect only the development workflow via Holographic Remoting
423+
if (UnityEngine.XR.WSA.HolographicRemoting.ConnectionState == UnityEngine.XR.WSA.HolographicStreamerConnectionState.Connected
424+
&& interactionSourceState.source.kind == InteractionSourceKind.Hand)
425+
{
426+
Debug.Assert(!interactionSourceState.selectPressed, "Unity issue #1033526 seems to have been resolved. Please remove this ugly workaround!");
427+
428+
Debug.Assert(!interactionSourceState.source.supportsGrasp);
429+
Debug.Assert(!interactionSourceState.source.supportsMenu);
430+
Debug.Assert(!interactionSourceState.source.supportsPointing);
431+
Debug.Assert(!interactionSourceState.source.supportsThumbstick);
432+
Debug.Assert(!interactionSourceState.source.supportsTouchpad);
433+
434+
selectPressed = interactionSourceState.anyPressed;
435+
}
436+
// END WORKAROUND: Unity issue #1033526
437+
417438
// Update the interaction data source
418-
interactionMapping.BoolData = interactionSourceState.selectPressed;
439+
interactionMapping.BoolData = selectPressed;
419440

420441
// If our value changed raise it.
421442
if (interactionMapping.Changed)
422443
{
423444
// Raise input system Event if it enabled
424-
if (interactionSourceState.selectPressed)
445+
if (selectPressed)
425446
{
426447
MixedRealityToolkit.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
427448
}

0 commit comments

Comments
 (0)