Skip to content

Commit 08164a3

Browse files
committed
DOCATT-8754: Updated TrackedDevice class documentation
1 parent 6f1ad16 commit 08164a3

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,85 @@ 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](https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@latest/index.html?subfolder=/manual/samples-spatial-keyboard.html)
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 or not.
41+
/// </summary>
42+
/// <remarks>
43+
/// This property can contain a simple bit (1 or 0), but for some Open XR devices, this might
44+
/// contain a float that includes bits that can indicate whether the device's position is actual
45+
/// or inferred from its last-known [pose](xref:openxr-input#pose-data) (OpenXR Plugin package).
46+
///
47+
/// For more information about how the float represents inferred position vs. actual position in
48+
/// OpenXR devices, refer to [Reference Spaces](https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#reference-spaces)
49+
/// (OpenXR Specification).
50+
/// </remarks>
1751
[InputControl(synthetic = true)]
1852
public ButtonControl isTracked { get; protected set; }
53+
54+
/// <summary>
55+
/// Represents the position portion of the input device's primary
56+
/// [pose](xref:input-system-tracked-input-devices#tracked-pose-driver). For an HMD
57+
/// device, this means the "center" eye position. For XR controllers, it means the "grip" pose.
58+
/// </summary>
59+
/// <remarks>
60+
/// For more information about how OpenXR represents the grip pose, refer to
61+
/// [Standard pose identifiers](https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#semantic-path-standard-identifiers)
62+
/// (OpenXR Specification).
63+
///
64+
/// > [!NOTE]
65+
/// > The position value is in the tracking space reported by the device, which doesn't match
66+
/// > Unity world space. Using a combination of the XR Origin component with the
67+
/// > [Tracked Pose Driver](xref:input-system-tracked-input-devices#tracked-pose-driver) component
68+
/// > to manage that conversion automatically is more reliable than managing it through scripting.
69+
/// </remarks>
1970
[InputControl(noisy = true, dontReset = true)]
2071
public Vector3Control devicePosition { get; protected set; }
72+
73+
/// <summary>
74+
/// Represents the rotation portion of the input device's primary
75+
/// [pose](xref:input-system-tracked-input-devices#tracked-pose-driver). For an HMD
76+
/// device, this means the "center" eye position. For XR controllers, it means the "grip" pose.
77+
/// </summary>
78+
/// <remarks>
79+
/// For more information about how OpenXR represents the grip pose, refer to
80+
/// [Standard pose identifiers](https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#semantic-path-standard-identifiers)
81+
/// (OpenXR Specification).
82+
///
83+
/// > [!NOTE]
84+
/// > The rotation value is in the tracking space reported by the device, which doesn't match
85+
/// > Unity world space. Using a combination of the XR Origin component with the
86+
/// > [Tracked Pose Driver](xref:input-system-tracked-input-devices#tracked-pose-driver) component
87+
/// > to manage that conversion automatically is more reliable than managing it through scripting.
88+
/// </remarks>
2189
[InputControl(noisy = true, dontReset = true)]
2290
public QuaternionControl deviceRotation { get; protected set; }
2391

0 commit comments

Comments
 (0)