Skip to content

Commit 1ef667d

Browse files
committed
Only query the fallback if needed and we're focused
Some tracking state actions will be disabled based on the focus state, and we want to respect that
1 parent a7514ef commit 1ef667d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

org.mixedrealitytoolkit.input/Tracking/HandPoseDriver.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class HandPoseDriver : TrackedPoseDriver
4848
internal bool IsPolyfillDevicePose { get; private set; }
4949

5050
#region Serialized Fields
51+
5152
[Header("Hand Pose Driver Settings")]
5253

5354
[SerializeField, Tooltip("The XRNode associated with this Hand Controller. Expected to be XRNode.LeftHand or XRNode.RightHand.")]
@@ -58,9 +59,11 @@ public class HandPoseDriver : TrackedPoseDriver
5859
/// </summary>
5960
/// <remarks>Expected to be XRNode.LeftHand or XRNode.RightHand.</remarks>
6061
public XRNode HandNode => handNode;
62+
6163
#endregion Serialized Fields
6264

6365
#region TrackedPoseDriver Overrides
66+
6467
/// <inheritdoc />
6568
protected override void PerformUpdate()
6669
{
@@ -91,7 +94,7 @@ protected override void PerformUpdate()
9194
(rotationInput.action == null || !rotationInput.action.HasAnyControls() || rotationInput.action.activeControl == null);
9295

9396
// We will also check the tracking state here to account for a bound action but untracked interaction profile.
94-
if ((missingPositionController || missingRotationController || IsTrackingNone()) &&
97+
if ((missingPositionController || missingRotationController || (IsTrackingNone() && Application.isFocused)) &&
9598
TryGetPolyfillDevicePose(out Pose devicePose))
9699
{
97100
m_trackingState = InputTrackingState.Position | InputTrackingState.Rotation;
@@ -103,9 +106,11 @@ protected override void PerformUpdate()
103106
IsPolyfillDevicePose = false;
104107
}
105108
}
109+
106110
#endregion TrackedPoseDriver Overrides
107111

108112
#region Private Functions
113+
109114
/// <summary>
110115
/// Check the tracking state here to account for a bound but untracked interaction profile.
111116
/// This could show up on runtimes where a controller is disconnected, hand tracking spins up,
@@ -280,6 +285,7 @@ private void OnTrackingStateInputCanceled(InputAction.CallbackContext context)
280285
m_trackingState = InputTrackingState.None;
281286
}
282287
}
288+
283289
#endregion Private Functions
284290
}
285291
}

0 commit comments

Comments
 (0)