Skip to content

Commit 40aaca8

Browse files
Fix pose isTracked incorrectly returning 0
1 parent 61d8245 commit 40aaca8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/XR/Controls

Packages/com.unity.inputsystem/InputSystem/Runtime/Plugins/XR/Controls/PoseControl.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public PoseState(bool isTracked, TrackingState trackingState, Vector3 position,
6060
/// <remarks>
6161
/// Fully tracked means that the pose is accurate and not using any simulated or extrapolated positions, and the system tracking this pose is able to confidently track this object.
6262
/// </remarks>
63-
[FieldOffset(0), InputControl(displayName = "Is Tracked", layout = "Button", sizeInBits = 8 /* needed to ensure optimization kicks-in */)]
63+
[FieldOffset(0), InputControl(displayName = "Is Tracked", layout = "Button", sizeInBits = 1)]
6464
public bool isTracked;
6565

6666
/// <summary>
@@ -252,7 +252,8 @@ protected override FourCC CalculateOptimizedControlDataType()
252252
if (
253253
m_StateBlock.sizeInBits == PoseState.kSizeInBytes * 8 &&
254254
m_StateBlock.bitOffset == 0 &&
255-
isTracked.optimizedControlDataType == InputStateBlock.kFormatByte &&
255+
isTracked.m_StateBlock.format == InputStateBlock.kFormatBit &&
256+
isTracked.m_StateBlock.sizeInBits == 1 &&
256257
trackingState.optimizedControlDataType == InputStateBlock.kFormatInt &&
257258
position.optimizedControlDataType == InputStateBlock.kFormatVector3 &&
258259
rotation.optimizedControlDataType == InputStateBlock.kFormatQuaternion &&

0 commit comments

Comments
 (0)