Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions org.mixedrealitytoolkit.input/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions org.mixedrealitytoolkit.input/Tracking/HandPoseDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,23 @@ 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;

/// <summary>
/// Expose the tracking state for the hand pose driver, to allow <see cref="TrackedPoseDriverExtensions"/> to query it.
/// </summary>
/// <remarks>
/// Avoid exposing this publicly as this <see cref="HandPoseDriver"/> is a workaround solution to support hand tracking on devices without interaction profiles.
/// </remarks>
internal InputTrackingState CachedTrackingState => m_trackingState;
internal InputTrackingState CachedTrackingState => IsPolyfillDevicePose ? m_polyfillTrackingState : m_trackingState;

/// <summary>
/// Get if the last pose set was from a polyfill device pose. That is, if the last pose originated from the <see cref="XRSubsystemHelpers.HandsAggregator "/>.
/// </summary>
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.")]
Expand All @@ -58,9 +60,11 @@ public class HandPoseDriver : TrackedPoseDriver
/// </summary>
/// <remarks>Expected to be XRNode.LeftHand or XRNode.RightHand.</remarks>
public XRNode HandNode => handNode;

#endregion Serialized Fields

#region TrackedPoseDriver Overrides

/// <inheritdoc />
protected override void PerformUpdate()
{
Expand Down Expand Up @@ -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);
}
Expand All @@ -103,9 +106,11 @@ protected override void PerformUpdate()
IsPolyfillDevicePose = false;
}
}

#endregion TrackedPoseDriver Overrides

#region Private Functions

/// <summary>
/// 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,
Expand Down Expand Up @@ -278,6 +283,7 @@ private void OnTrackingStateInputCanceled(InputAction.CallbackContext context)
m_trackingState = InputTrackingState.None;
}
}

#endregion Private Functions
}
}