Skip to content

Commit 20d06ce

Browse files
DOCS: DOCATT-8754: Updated TrackedDevice class documentation (#2298)
Co-authored-by: Chris Massie <67029035+chris-massie@users.noreply.github.com>
1 parent 05e8e90 commit 20d06ce

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"hideGlobalNamespace": true
2+
"hideGlobalNamespace": true,
3+
"xref": [
4+
"com.unity.xr.openxr",
5+
"com.unity.xr.interaction.toolkit"
6+
]
37
}

Packages/com.unity.inputsystem/InputSystem/Devices/TrackedDevice.cs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,81 @@ namespace UnityEngine.InputSystem
77
/// <summary>
88
/// An input device that has its orientation and position in space tracked.
99
/// </summary>
10+
/// <remarks>
11+
/// These values are typically read from input actions and fed into the
12+
/// [Tracked Pose Driver](xref:input-system-tracked-input-devices#tracked-pose-driver)
13+
/// component rather than being read directly from this class.
14+
///
15+
/// Refer to the [Starter Assets](xref:xri-samples-starter-assets)
16+
/// sample in the XR Interaction Toolkit package for a Demo Scene with an XR rig
17+
/// hierarchy that uses these concepts.
18+
/// </remarks>
1019
/// <seealso cref="UnityEngine.InputSystem.XR.XRController"/>
1120
/// <seealso cref="UnityEngine.InputSystem.XR.XRHMD"/>
21+
/// <seealso href="https://docs.unity3d.com/Packages/com.unity.xr.openxr@latest/index.html?subfolder=/api/UnityEngine.XR.OpenXR.Input.Pose.html">UnityEngine.XR.OpenXR.Input.Pose</seealso>
1222
[InputControlLayout(displayName = "Tracked Device", isGenericTypeOfDevice = true)]
1323
public class TrackedDevice : InputDevice
1424
{
25+
/// <summary>
26+
/// Indicates which of the tracked pose components are valid by using an integer containing a
27+
/// bitwise OR of the [Unity XR module enum values](https://docs.unity3d.com/ScriptReference/XR.InputTrackingState.html),
28+
/// for example `InputTrackingState.Position | InputTrackingState.Rotation`.
29+
/// </summary>
30+
/// <remarks>
31+
/// This property determines whether you can retrieve valid values from the
32+
/// <see cref="devicePosition"/> and the <see cref="deviceRotation"/> properties:
33+
/// - The Position bit must be set for the <see cref="devicePosition"/> property to have a valid Vector3 value.
34+
/// - The Rotation bit must be set for the <see cref="deviceRotation"/> property to have a valid Quaternion.
35+
/// </remarks>
1536
[InputControl(synthetic = true)]
1637
public IntegerControl trackingState { get; protected set; }
38+
39+
/// <summary>
40+
/// Indicates whether the input device is actively tracked (1) or not (0).
41+
/// </summary>
42+
/// <remarks>
43+
/// For more information about how OpenXR represents inferred position vs. actual position, refer to
44+
/// [Reference Spaces](https://registry.khronos.org/OpenXR/specs/1.1/html/xrspec.html#spaces-reference-spaces)
45+
/// (OpenXR Specification).
46+
/// </remarks>
1747
[InputControl(synthetic = true)]
1848
public ButtonControl isTracked { get; protected set; }
49+
50+
/// <summary>
51+
/// Represents the position portion of the input device's primary
52+
/// [pose](xref:input-system-tracked-input-devices#tracked-pose-driver). For an HMD
53+
/// device, this means the "center" eye pose. For XR controllers, it means the "grip" pose.
54+
/// </summary>
55+
/// <remarks>
56+
/// For more information about how OpenXR represents the grip pose, refer to
57+
/// [Standard pose identifiers](https://registry.khronos.org/OpenXR/specs/1.1/html/xrspec.html#semantic-paths-standard-identifiers)
58+
/// (OpenXR Specification).
59+
///
60+
/// > [!NOTE]
61+
/// > The position value is in the tracking space reported by the device, which doesn't match
62+
/// > Unity world space. Using a combination of the XR Origin component with the
63+
/// > [Tracked Pose Driver](xref:input-system-tracked-input-devices#tracked-pose-driver) component
64+
/// > to manage that conversion automatically is more reliable than managing it through scripting.
65+
/// </remarks>
1966
[InputControl(noisy = true, dontReset = true)]
2067
public Vector3Control devicePosition { get; protected set; }
68+
69+
/// <summary>
70+
/// Represents the rotation portion of the input device's primary
71+
/// [pose](xref:openxr-input#pose-data). For an HMD
72+
/// device, this means the "center" eye pose. For XR controllers, it means the "grip" pose.
73+
/// </summary>
74+
/// <remarks>
75+
/// For more information about how OpenXR represents the grip pose, refer to
76+
/// [Standard pose identifiers](https://registry.khronos.org/OpenXR/specs/1.1/html/xrspec.html#semantic-paths-standard-identifiers)
77+
/// (OpenXR Specification).
78+
///
79+
/// > [!NOTE]
80+
/// > The rotation value is in the tracking space reported by the device, which doesn't match
81+
/// > Unity world space. Using a combination of the XR Origin component with the
82+
/// > [Tracked Pose Driver](xref:input-system-tracked-input-devices#tracked-pose-driver) component
83+
/// > to manage that conversion automatically is more reliable than managing it through scripting.
84+
/// </remarks>
2185
[InputControl(noisy = true, dontReset = true)]
2286
public QuaternionControl deviceRotation { get; protected set; }
2387

0 commit comments

Comments
 (0)