Skip to content

Commit

Permalink
Use IsPressed for isTracked
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoco007 committed Jan 21, 2025
1 parent b7f8daa commit a128169
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions Source/CustomAvatar/Tracking/UnityXR/UnityXRDeviceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,7 @@ internal DeviceState GetDeviceState()
return default;
}

bool isTracked = isTrackedAction.ReadValue<float>() > 0.5f;

// If we don't check isTracked here, positionAction.ReadValue below throws an InvalidOperationException when the OpenXR loader is disabled.
if (!isTracked)
{
return new DeviceState(isConnected, isTracked, Vector3.zero, Quaternion.identity);
}

return new DeviceState(isConnected, isTracked, positionAction.ReadValue<Vector3>(), orientationAction.ReadValue<Quaternion>());
return new DeviceState(isConnected, isTrackedAction.IsPressed(), positionAction.ReadValue<Vector3>(), orientationAction.ReadValue<Quaternion>());
}
}
}
Expand Down

0 comments on commit a128169

Please sign in to comment.