docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct TrackedDeviceModel

    Models a tracked device.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.Interaction.Toolkit.UI
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    public struct TrackedDeviceModel

    Constructors

    TrackedDeviceModel(int)

    Initializes and returns an instance of TrackedDeviceModel.

    Declaration
    public TrackedDeviceModel(int pointerId)
    Parameters
    Type Name Description
    int pointerId

    The pointer id.

    Properties

    changedThisFrame

    Checks whether this model has meaningfully changed this frame. This is used by the UI system to avoid excessive work. Use OnFrameFinished() to reset.

    Declaration
    public readonly bool changedThisFrame { get; }
    Property Value
    Type Description
    bool

    clickOnDown

    Whether or not the model should allow UI click events to be fired on press down instead of after release.

    Declaration
    public bool clickOnDown { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    This is typically for more responsive UI poke interaction.

    currentRaycast

    The last ray cast done for this model.

    Declaration
    public readonly RaycastResult currentRaycast { get; }
    Property Value
    Type Description
    RaycastResult
    See Also
    pointerCurrentRaycast

    currentRaycastEndpointIndex

    The endpoint index within the list of ray cast points that the currentRaycast refers to when a hit occurred. Otherwise, a value of 0 if no hit occurred.

    Declaration
    public readonly int currentRaycastEndpointIndex { get; }
    Property Value
    Type Description
    int
    See Also
    currentRaycast
    raycastPoints
    rayHitIndex

    interactionType

    The interaction type expected by this TrackedDeviceModel. It affects the handling of raycasts in the TrackedDeviceGraphicRaycaster.

    Declaration
    public UIInteractionType interactionType { get; set; }
    Property Value
    Type Description
    UIInteractionType
    See Also
    UIInteractionType

    invalid

    Returns a struct representing an invalid pointer id. This can be used when returning an instance from a method to represent invalid data.

    Declaration
    public static TrackedDeviceModel invalid { get; }
    Property Value
    Type Description
    TrackedDeviceModel
    See Also
    TryGetUIModel(out TrackedDeviceModel)

    isScrollable

    Tracks whether the current hovered UI elements support scrolling.

    Declaration
    public bool isScrollable { readonly get; set; }
    Property Value
    Type Description
    bool

    orientation

    The world starting orientation of the cast for the tracked device.

    Declaration
    public Quaternion orientation { get; set; }
    Property Value
    Type Description
    Quaternion

    pointerId

    (Read Only) A unique Id to identify this model from others within the UI system.

    Declaration
    public readonly int pointerId { get; }
    Property Value
    Type Description
    int

    pokeDepth

    Distance along the poke interactable interaction axis that allows for a poke to be triggered. Only applies with Poke.

    Declaration
    public float pokeDepth { get; set; }
    Property Value
    Type Description
    float
    See Also
    pokeDepth

    position

    The world starting position of the cast for the tracked device.

    Declaration
    public Vector3 position { get; set; }
    Property Value
    Type Description
    Vector3
    See Also
    positionProvider

    positionProvider

    Overrides the position point used for the world starting position of the cast with a function that returns the position instead. This position function allows for accurate just in time position querying. Necessary for poke interaction with uGUI (Unity UI) if the frame of reference is moving rapidly.

    Declaration
    public Func<Vector3> positionProvider { get; set; }
    Property Value
    Type Description
    Func<Vector3>
    See Also
    position

    raycastLayerMask

    Layer mask for ray casts.

    Declaration
    public LayerMask raycastLayerMask { get; set; }
    Property Value
    Type Description
    LayerMask

    raycastPoints

    A series of Ray segments used to hit UI.

    Declaration
    public List<Vector3> raycastPoints { get; set; }
    Property Value
    Type Description
    List<Vector3>
    Remarks

    A polygonal chain represented by a list of endpoints which form line segments to approximate the curve. Each line segment is where the ray cast starts and ends. World space coordinates.

    scrollDelta

    The amount of scroll since the last update.

    Declaration
    public Vector2 scrollDelta { get; set; }
    Property Value
    Type Description
    Vector2
    See Also
    scrollDelta

    select

    Whether or not the model should be selecting UI at this moment. This is the equivalent of left mouse down for a mouse.

    Declaration
    public bool select { get; set; }
    Property Value
    Type Description
    bool

    selectDelta

    Whether the state of the select option has changed this frame.

    Declaration
    public readonly ButtonDeltaState selectDelta { get; }
    Property Value
    Type Description
    ButtonDeltaState

    selectableObject

    Tracks the current selectable UI element being hovered

    Declaration
    public GameObject selectableObject { readonly get; set; }
    Property Value
    Type Description
    GameObject

    Methods

    CopyFrom(TrackedDeviceEventData)

    Copies data from the UI Event Data to this model.

    Declaration
    public void CopyFrom(TrackedDeviceEventData eventData)
    Parameters
    Type Name Description
    TrackedDeviceEventData eventData

    The data to copy from.

    See Also
    CopyTo(TrackedDeviceEventData)

    CopyTo(TrackedDeviceEventData)

    Copies data from this model to the UI Event Data.

    Declaration
    public void CopyTo(TrackedDeviceEventData eventData)
    Parameters
    Type Name Description
    TrackedDeviceEventData eventData

    The event that copies the data.

    See Also
    CopyFrom(TrackedDeviceEventData)

    OnFrameFinished()

    To be called at the end of each frame to reset any tracking of changes within the frame.

    Declaration
    public void OnFrameFinished()
    See Also
    selectDelta
    changedThisFrame

    Reset(bool)

    Resets this object back to defaults.

    Declaration
    public void Reset(bool resetImplementation = true)
    Parameters
    Type Name Description
    bool resetImplementation

    If false, will reset only the external state of the object, and not internal, UI-used variables. Defaults to true.

    In This Article
    Back to top
    Copyright © 2025 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)