diff --git a/org.mixedrealitytoolkit.input/CHANGELOG.md b/org.mixedrealitytoolkit.input/CHANGELOG.md index bb0000f72..c0d4c98a3 100644 --- a/org.mixedrealitytoolkit.input/CHANGELOG.md +++ b/org.mixedrealitytoolkit.input/CHANGELOG.md @@ -2,6 +2,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +## Unreleased + +### Fixed + +* Fix issue where `HandPoseDriver` could get into a state where it temporarily polyfilled, but then was unable to, and then got stuck in a "tracked" state. [PR #1088](https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity/pull/1088) + ## [4.0.0-pre.2] - 2025-12-05 ### Changed diff --git a/org.mixedrealitytoolkit.input/Tracking/HandPoseDriver.cs b/org.mixedrealitytoolkit.input/Tracking/HandPoseDriver.cs index 0872c35d6..b0c9dc106 100644 --- a/org.mixedrealitytoolkit.input/Tracking/HandPoseDriver.cs +++ b/org.mixedrealitytoolkit.input/Tracking/HandPoseDriver.cs @@ -33,6 +33,7 @@ public class HandPoseDriver : TrackedPoseDriver private bool m_firstUpdate = true; private InputAction m_boundTrackingAction = null; private InputTrackingState m_trackingState = InputTrackingState.None; + private const InputTrackingState m_polyfillTrackingState = InputTrackingState.Position | InputTrackingState.Rotation; /// /// Expose the tracking state for the hand pose driver, to allow to query it. @@ -40,7 +41,7 @@ public class HandPoseDriver : TrackedPoseDriver /// /// Avoid exposing this publicly as this is a workaround solution to support hand tracking on devices without interaction profiles. /// - internal InputTrackingState CachedTrackingState => m_trackingState; + internal InputTrackingState CachedTrackingState => IsPolyfillDevicePose ? m_polyfillTrackingState : m_trackingState; /// /// Get if the last pose set was from a polyfill device pose. That is, if the last pose originated from the . @@ -48,6 +49,7 @@ public class HandPoseDriver : TrackedPoseDriver internal bool IsPolyfillDevicePose { get; private set; } #region Serialized Fields + [Header("Hand Pose Driver Settings")] [SerializeField, Tooltip("The XRNode associated with this Hand Controller. Expected to be XRNode.LeftHand or XRNode.RightHand.")] @@ -58,9 +60,11 @@ public class HandPoseDriver : TrackedPoseDriver /// /// Expected to be XRNode.LeftHand or XRNode.RightHand. public XRNode HandNode => handNode; + #endregion Serialized Fields #region TrackedPoseDriver Overrides + /// protected override void PerformUpdate() { @@ -94,7 +98,6 @@ protected override void PerformUpdate() if ((missingPositionController || missingRotationController || IsTrackingNone()) && TryGetPolyfillDevicePose(out Pose devicePose)) { - m_trackingState = InputTrackingState.Position | InputTrackingState.Rotation; IsPolyfillDevicePose = true; ForceSetLocalTransform(devicePose.position, devicePose.rotation); } @@ -103,9 +106,11 @@ protected override void PerformUpdate() IsPolyfillDevicePose = false; } } + #endregion TrackedPoseDriver Overrides #region Private Functions + /// /// Check the tracking state here to account for a bound but untracked interaction profile. /// This could show up on runtimes where a controller is disconnected, hand tracking spins up, @@ -278,6 +283,7 @@ private void OnTrackingStateInputCanceled(InputAction.CallbackContext context) m_trackingState = InputTrackingState.None; } } + #endregion Private Functions } }