Skip to content

Commit c36b0e7

Browse files
author
David Kline
authored
Merge pull request #3496 from NorbertNemec/workaround-unity-bug-airtap-remoting
Fix air-tap in Holographic Remoting (workaround for Unity issue #1033526)
2 parents 84733b2 + fabdd6b commit c36b0e7

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/WindowsMixedRealityController.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,37 @@ 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 is unknown
422+
// The bug only affects the development workflow via Holographic Remoting or Simulation
423+
if (interactionSourceState.source.kind == InteractionSourceKind.Hand)
424+
{
425+
Debug.Assert(!(UnityEngine.XR.WSA.HolographicRemoting.ConnectionState == UnityEngine.XR.WSA.HolographicStreamerConnectionState.Connected
426+
&& interactionSourceState.selectPressed),
427+
"Unity issue #1033526 seems to have been resolved. Please remove this ugly workaround!");
428+
429+
// This workaround is safe as long as all these assumptions hold:
430+
Debug.Assert(!interactionSourceState.source.supportsGrasp);
431+
Debug.Assert(!interactionSourceState.source.supportsMenu);
432+
Debug.Assert(!interactionSourceState.source.supportsPointing);
433+
Debug.Assert(!interactionSourceState.source.supportsThumbstick);
434+
Debug.Assert(!interactionSourceState.source.supportsTouchpad);
435+
436+
selectPressed = interactionSourceState.anyPressed;
437+
}
438+
// END WORKAROUND: Unity issue #1033526
439+
417440
// Update the interaction data source
418-
interactionMapping.BoolData = interactionSourceState.selectPressed;
441+
interactionMapping.BoolData = selectPressed;
419442

420443
// If our value changed raise it.
421444
if (interactionMapping.Changed)
422445
{
423446
// Raise input system Event if it enabled
424-
if (interactionSourceState.selectPressed)
447+
if (selectPressed)
425448
{
426449
MixedRealityToolkit.InputSystem?.RaiseOnInputDown(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction);
427450
}

0 commit comments

Comments
 (0)