docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TrackedDevice

    An input device that has its orientation and position in space tracked.

    Inheritance
    object
    InputControl
    InputDevice
    TrackedDevice
    XRController
    XRHMD
    Inherited Members
    InputDevice.InvalidDeviceId
    InputDevice.description
    InputDevice.enabled
    InputDevice.canRunInBackground
    InputDevice.added
    InputDevice.remote
    InputDevice.native
    InputDevice.updateBeforeRender
    InputDevice.deviceId
    InputDevice.lastUpdateTime
    InputDevice.wasUpdatedThisFrame
    InputDevice.allControls
    InputDevice.valueType
    InputDevice.valueSizeInBytes
    InputDevice.ReadValueFromBufferAsObject(void*, int)
    InputDevice.ReadValueFromStateAsObject(void*)
    InputDevice.ReadValueFromStateIntoBuffer(void*, void*, int)
    InputDevice.CompareValue(void*, void*)
    InputDevice.MakeCurrent()
    InputDevice.OnAdded()
    InputDevice.OnRemoved()
    InputDevice.OnConfigurationChanged()
    InputDevice.ExecuteCommand<TCommand>(ref TCommand)
    InputDevice.ExecuteCommand(InputDeviceCommand*)
    InputControl.name
    InputControl.displayName
    InputControl.shortDisplayName
    InputControl.path
    InputControl.layout
    InputControl.variants
    InputControl.device
    InputControl.parent
    InputControl.children
    InputControl.usages
    InputControl.aliases
    InputControl.stateBlock
    InputControl.noisy
    InputControl.synthetic
    InputControl.this[string]
    InputControl.magnitude
    InputControl.ToString()
    InputControl.EvaluateMagnitude()
    InputControl.EvaluateMagnitude(void*)
    InputControl.WriteValueFromBufferIntoState(void*, int, void*)
    InputControl.WriteValueFromObjectIntoState(object, void*)
    InputControl.TryGetChildControl(string)
    InputControl.TryGetChildControl<TControl>(string)
    InputControl.GetChildControl(string)
    InputControl.GetChildControl<TControl>(string)
    InputControl.RefreshConfigurationIfNeeded()
    InputControl.RefreshConfiguration()
    InputControl.m_StateBlock
    InputControl.currentStatePtr
    InputControl.previousFrameStatePtr
    InputControl.defaultStatePtr
    InputControl.noiseMaskPtr
    InputControl.stateOffsetRelativeToDeviceRoot
    InputControl.optimizedControlDataType
    InputControl.CalculateOptimizedControlDataType()
    InputControl.ApplyParameterChanges()
    Namespace: UnityEngine.InputSystem
    Assembly: Unity.InputSystem.dll
    Syntax
    public class TrackedDevice : InputDevice
    Remarks

    These values are typically read from input actions and fed into the Tracked Pose Driver component rather than being read directly from this class.

    Refer to the Starter Assets sample in the XR Interaction Toolkit package for a Demo Scene with an XR rig hierarchy that uses these concepts.

    Properties

    devicePosition

    Represents the position portion of the input device's primary pose. For an HMD device, this means the "center" eye pose. For XR controllers, it means the "grip" pose.

    Declaration
    public Vector3Control devicePosition { get; protected set; }
    Property Value
    Type Description
    Vector3Control
    Remarks

    For more information about how OpenXR represents the grip pose, refer to Standard pose identifiers (OpenXR Specification).

    Note

    The position value is in the tracking space reported by the device, which doesn't match Unity world space. Using a combination of the XR Origin component with the Tracked Pose Driver component to manage that conversion automatically is more reliable than managing it through scripting.

    See Also
    XRController
    XRHMD
    UnityEngine.XR.OpenXR.Input.Pose

    deviceRotation

    Represents the rotation portion of the input device's primary pose. For an HMD device, this means the "center" eye pose. For XR controllers, it means the "grip" pose.

    Declaration
    public QuaternionControl deviceRotation { get; protected set; }
    Property Value
    Type Description
    QuaternionControl
    Remarks

    For more information about how OpenXR represents the grip pose, refer to Standard pose identifiers (OpenXR Specification).

    Note

    The rotation value is in the tracking space reported by the device, which doesn't match Unity world space. Using a combination of the XR Origin component with the Tracked Pose Driver component to manage that conversion automatically is more reliable than managing it through scripting.

    See Also
    XRController
    XRHMD
    UnityEngine.XR.OpenXR.Input.Pose

    isTracked

    Indicates whether the input device is actively tracked (1) or not (0).

    Declaration
    public ButtonControl isTracked { get; protected set; }
    Property Value
    Type Description
    ButtonControl
    Remarks

    For more information about how OpenXR represents inferred position vs. actual position, refer to Reference Spaces (OpenXR Specification).

    See Also
    XRController
    XRHMD
    UnityEngine.XR.OpenXR.Input.Pose

    trackingState

    Indicates which of the tracked pose components are valid by using an integer containing a bitwise OR of the Unity XR module enum values, for example InputTrackingState.Position | InputTrackingState.Rotation.

    Declaration
    public IntegerControl trackingState { get; protected set; }
    Property Value
    Type Description
    IntegerControl
    Remarks

    This property determines whether you can retrieve valid values from the devicePosition and the deviceRotation properties:

    • The Position bit must be set for the devicePosition property to have a valid Vector3 value.
    • The Rotation bit must be set for the deviceRotation property to have a valid Quaternion.
    See Also
    XRController
    XRHMD
    UnityEngine.XR.OpenXR.Input.Pose

    Methods

    FinishSetup()

    Perform final initialization tasks after the control hierarchy has been put into place.

    Declaration
    protected override void FinishSetup()
    Overrides
    InputControl.FinishSetup()
    Remarks

    This method can be overridden to perform control- or device-specific setup work. The most common use case is for looking up child controls and storing them in local getters.

    Examples
      public class MyDevice : InputDevice
                            {
                                public ButtonControl button { get; private set; }
                                public AxisControl axis { get; private set; }
    
                                protected override void OnFinishSetup()
                                {
                                    // Cache controls in getters.
                                    button = GetChildControl("button");
                                    axis = GetChildControl("axis");
                                }
                            }
    
    See Also
    XRController
    XRHMD
    UnityEngine.XR.OpenXR.Input.Pose

    Extension Methods

    InputControlExtensions.CheckStateIsAtDefault(InputControl)
    InputControlExtensions.CheckStateIsAtDefault(InputControl, void*, void*)
    InputControlExtensions.CheckStateIsAtDefaultIgnoringNoise(InputControl)
    InputControlExtensions.CheckStateIsAtDefaultIgnoringNoise(InputControl, void*)
    InputControlExtensions.CompareState(InputControl, void*, void*)
    InputControlExtensions.CompareState(InputControl, void*, void*, void*)
    InputControlExtensions.CompareStateIgnoringNoise(InputControl, void*)
    InputControlExtensions.FindControlsRecursive<TControl>(InputControl, IList<TControl>, Func<TControl, bool>)
    InputControlExtensions.FindInParentChain<TControl>(InputControl)
    InputControlExtensions.GetStatePtrFromStateEvent(InputControl, InputEventPtr)
    InputControlExtensions.HasValueChangeInEvent(InputControl, InputEventPtr)
    InputControlExtensions.HasValueChangeInState(InputControl, void*)
    InputControlExtensions.IsActuated(InputControl, float)
    InputControlExtensions.IsPressed(InputControl, float)
    InputControlExtensions.ReadDefaultValueAsObject(InputControl)
    InputControlExtensions.ReadValueAsObject(InputControl)
    InputControlExtensions.ReadValueFromEventAsObject(InputControl, InputEventPtr)
    InputControlExtensions.ReadValueIntoBuffer(InputControl, void*, int)
    InputControlExtensions.ResetToDefaultStateInEvent(InputControl, InputEventPtr)
    InputControlExtensions.WriteValueFromObjectIntoEvent(InputControl, InputEventPtr, object)
    InputControlExtensions.WriteValueIntoEvent<TValue>(InputControl, TValue, InputEventPtr)
    InputControlExtensions.WriteValueIntoState(InputControl, void*)
    InputControlExtensions.WriteValueIntoState<TValue>(InputControl, TValue, void*)
    InputControlExtensions.CopyState(InputDevice, void*, int)
    InputControlExtensions.CopyState<TState>(InputDevice, out TState)

    See Also

    XRController
    XRHMD
    UnityEngine.XR.OpenXR.Input.Pose
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)