docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IXRRayProvider

    An interface that represents a Transform-driven XR Ray.

    Namespace: UnityEngine.XR.Interaction.Toolkit.Interactors
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    [MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
    public interface IXRRayProvider

    Properties

    rayEndPoint

    The last endpoint of this ray, either its maximum distance or a collision point.

    Declaration
    Vector3 rayEndPoint { get; }
    Property Value
    Type Description
    Vector3
    See Also
    XRRayInteractor
    XRGazeAssistance

    rayEndTransform

    The Transform of the object this ray has collided with, if any.

    Declaration
    Transform rayEndTransform { get; }
    Property Value
    Type Description
    Transform
    See Also
    XRRayInteractor
    XRGazeAssistance

    Methods

    GetOrCreateAttachTransform()

    Ensures a Transform exists for the ray attach point and returns it.

    Declaration
    Transform GetOrCreateAttachTransform()
    Returns
    Type Description
    Transform

    The Transform that is used as the attach point for Interactables.

    See Also
    XRRayInteractor
    XRGazeAssistance

    GetOrCreateRayOrigin()

    Ensures a Transform exists for the ray origin and returns it.

    Declaration
    Transform GetOrCreateRayOrigin()
    Returns
    Type Description
    Transform

    The Transform that is the starting position and direction of any ray casts.

    See Also
    XRRayInteractor
    XRGazeAssistance

    SetAttachTransform(Transform)

    Assigns a Transform to be the attach point of this ray.

    Declaration
    void SetAttachTransform(Transform newAttach)
    Parameters
    Type Name Description
    Transform newAttach

    The Transform that is used as the attach point for Interactables.

    See Also
    XRRayInteractor
    XRGazeAssistance

    SetRayOrigin(Transform)

    Assigns a Transform to be the source of this ray.

    Declaration
    void SetRayOrigin(Transform newOrigin)
    Parameters
    Type Name Description
    Transform newOrigin

    The Transform that is the starting position and direction of any ray casts.

    See Also
    XRRayInteractor
    XRGazeAssistance

    See Also

    XRRayInteractor
    XRGazeAssistance
    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)