docs.unity3d.com
    Show / Hide Table of Contents

    Class XRRayInteractor

    Interactor used for interacting with interactables at a distance. This is handled via raycasts that update the current set of valid targets for this interactor.

    Inheritance
    Object
    XRBaseInteractor
    XRBaseControllerInteractor
    XRRayInteractor
    Inherited Members
    XRBaseControllerInteractor.selectActionTrigger
    XRBaseControllerInteractor.hideControllerOnSelect
    XRBaseControllerInteractor.playAudioClipOnSelectEntered
    XRBaseControllerInteractor.audioClipForOnSelectEntered
    XRBaseControllerInteractor.playAudioClipOnSelectExited
    XRBaseControllerInteractor.audioClipForOnSelectExited
    XRBaseControllerInteractor.playAudioClipOnSelectCanceled
    XRBaseControllerInteractor.audioClipForOnSelectCanceled
    XRBaseControllerInteractor.playAudioClipOnHoverEntered
    XRBaseControllerInteractor.audioClipForOnHoverEntered
    XRBaseControllerInteractor.playAudioClipOnHoverExited
    XRBaseControllerInteractor.audioClipForOnHoverExited
    XRBaseControllerInteractor.playAudioClipOnHoverCanceled
    XRBaseControllerInteractor.audioClipForOnHoverCanceled
    XRBaseControllerInteractor.playHapticsOnSelectEntered
    XRBaseControllerInteractor.hapticSelectEnterIntensity
    XRBaseControllerInteractor.hapticSelectEnterDuration
    XRBaseControllerInteractor.playHapticsOnSelectExited
    XRBaseControllerInteractor.hapticSelectExitIntensity
    XRBaseControllerInteractor.hapticSelectExitDuration
    XRBaseControllerInteractor.playHapticsOnSelectCanceled
    XRBaseControllerInteractor.hapticSelectCancelIntensity
    XRBaseControllerInteractor.hapticSelectCancelDuration
    XRBaseControllerInteractor.playHapticsOnHoverEntered
    XRBaseControllerInteractor.hapticHoverEnterIntensity
    XRBaseControllerInteractor.hapticHoverEnterDuration
    XRBaseControllerInteractor.playHapticsOnHoverExited
    XRBaseControllerInteractor.hapticHoverExitIntensity
    XRBaseControllerInteractor.hapticHoverExitDuration
    XRBaseControllerInteractor.playHapticsOnHoverCanceled
    XRBaseControllerInteractor.hapticHoverCancelIntensity
    XRBaseControllerInteractor.hapticHoverCancelDuration
    XRBaseControllerInteractor.xrController
    XRBaseControllerInteractor.isUISelectActive
    XRBaseControllerInteractor.OnHoverEntering(HoverEnterEventArgs)
    XRBaseControllerInteractor.OnHoverExiting(HoverExitEventArgs)
    XRBaseControllerInteractor.SendHapticImpulse(Single, Single)
    XRBaseControllerInteractor.PlayAudio(AudioClip)
    XRBaseControllerInteractor.playAudioClipOnSelectEnter
    XRBaseControllerInteractor.audioClipForOnSelectEnter
    XRBaseControllerInteractor.AudioClipForOnSelectEnter
    XRBaseControllerInteractor.playAudioClipOnSelectExit
    XRBaseControllerInteractor.audioClipForOnSelectExit
    XRBaseControllerInteractor.AudioClipForOnSelectExit
    XRBaseControllerInteractor.playAudioClipOnHoverEnter
    XRBaseControllerInteractor.audioClipForOnHoverEnter
    XRBaseControllerInteractor.AudioClipForOnHoverEnter
    XRBaseControllerInteractor.playAudioClipOnHoverExit
    XRBaseControllerInteractor.audioClipForOnHoverExit
    XRBaseControllerInteractor.AudioClipForOnHoverExit
    XRBaseControllerInteractor.playHapticsOnSelectEnter
    XRBaseControllerInteractor.playHapticsOnSelectExit
    XRBaseControllerInteractor.playHapticsOnHoverEnter
    XRBaseInteractor.registered
    XRBaseInteractor.unregistered
    XRBaseInteractor.interactionManager
    XRBaseInteractor.interactionLayerMask
    XRBaseInteractor.attachTransform
    XRBaseInteractor.startingSelectedInteractable
    XRBaseInteractor.hoverEntered
    XRBaseInteractor.hoverExited
    XRBaseInteractor.selectEntered
    XRBaseInteractor.selectExited
    XRBaseInteractor.allowHover
    XRBaseInteractor.allowSelect
    XRBaseInteractor.isPerformingManualInteraction
    XRBaseInteractor.selectTarget
    XRBaseInteractor.hoverTargets
    XRBaseInteractor.Reset()
    XRBaseInteractor.Start()
    XRBaseInteractor.OnDestroy()
    XRBaseInteractor.GetHoverTargets(List<XRBaseInteractable>)
    XRBaseInteractor.isHoverActive
    XRBaseInteractor.requireSelectExclusive
    XRBaseInteractor.selectedInteractableMovementTypeOverride
    XRBaseInteractor.OnRegistered(InteractorRegisteredEventArgs)
    XRBaseInteractor.OnUnregistered(InteractorUnregisteredEventArgs)
    XRBaseInteractor.OnHoverEntered(HoverEnterEventArgs)
    XRBaseInteractor.OnHoverExited(HoverExitEventArgs)
    XRBaseInteractor.OnSelectEntered(SelectEnterEventArgs)
    XRBaseInteractor.OnSelectExited(SelectExitEventArgs)
    XRBaseInteractor.StartManualInteraction(XRBaseInteractable)
    XRBaseInteractor.EndManualInteraction()
    XRBaseInteractor.enableInteractions
    XRBaseInteractor.onHoverEntered
    XRBaseInteractor.onHoverExited
    XRBaseInteractor.onSelectEntered
    XRBaseInteractor.onSelectExited
    XRBaseInteractor.onHoverEnter
    XRBaseInteractor.onHoverExit
    XRBaseInteractor.onSelectEnter
    XRBaseInteractor.onSelectExit
    XRBaseInteractor.OnHoverEntering(XRBaseInteractable)
    XRBaseInteractor.OnHoverEntered(XRBaseInteractable)
    XRBaseInteractor.OnHoverExiting(XRBaseInteractable)
    XRBaseInteractor.OnHoverExited(XRBaseInteractable)
    XRBaseInteractor.OnSelectEntering(XRBaseInteractable)
    XRBaseInteractor.OnSelectEntered(XRBaseInteractable)
    XRBaseInteractor.OnSelectExiting(XRBaseInteractable)
    XRBaseInteractor.OnSelectExited(XRBaseInteractable)
    Namespace: UnityEngine.XR.Interaction.Toolkit
    Syntax
    public class XRRayInteractor : XRBaseControllerInteractor, ILineRenderable, IUIInteractor

    Properties

    acceleration

    Gravity of the projectile in the reference frame.

    Declaration
    public float acceleration { get; set; }
    Property Value
    Type Description
    Single
    See Also
    ProjectileCurve

    Acceleration

    Gravity of the projectile in the reference frame.

    Declaration
    public float Acceleration { get; set; }
    Property Value
    Type Description
    Single
    See Also
    ProjectileCurve

    additionalFlightTime

    Additional flight time after the projectile lands at the adjusted ground level. Increasing this value will make the end point drop lower in height.

    Declaration
    public float additionalFlightTime { get; set; }
    Property Value
    Type Description
    Single
    See Also
    ProjectileCurve

    AdditionalFlightTime

    Additional flight time after the projectile lands at the adjusted ground level. Increasing this value will make the end point drop lower in height.

    Declaration
    public float AdditionalFlightTime { get; set; }
    Property Value
    Type Description
    Single
    See Also
    ProjectileCurve

    additionalGroundHeight

    Additional height below ground level that the projectile will continue to. Increasing this value will make the end point drop lower in height.

    Declaration
    public float additionalGroundHeight { get; set; }
    Property Value
    Type Description
    Single
    See Also
    ProjectileCurve

    allowAnchorControl

    Allows the user to move the attach anchor point using the joystick.

    Declaration
    public bool allowAnchorControl { get; set; }
    Property Value
    Type Description
    Boolean
    See Also
    rotateSpeed
    translateSpeed
    anchorRotateReferenceFrame

    anchorRotateReferenceFrame

    The optional reference frame to define the up axis when rotating the attach anchor point. When not set, rotates about the local up axis of the attach transform.

    Declaration
    public Transform anchorRotateReferenceFrame { get; set; }
    Property Value
    Type Description
    Transform
    See Also
    allowAnchorControl
    RotateAnchor(Transform, Single)

    angle

    The launch angle of the Projectile Curve. More specifically, this is the signed angle in degrees between the original attach forward direction and the plane of the reference frame, with positive angles when pointing upward.

    Declaration
    public float angle { get; }
    Property Value
    Type Description
    Single

    Angle

    The launch angle of the Projectile Curve. More specifically, this is the signed angle in degrees between the original attach forward direction and the plane of the reference frame, with positive angles when pointing upward.

    Declaration
    public float Angle { get; }
    Property Value
    Type Description
    Single

    blendVisualLinePoints

    Blend the line sample points used for raycasting with the current pose of the controller. Use this to make the line visual stay connected with the controller instead of lagging behind.

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

    When the controller is configured to sample tracking input directly before rendering to reduce input latency, the controller may be in a new position or rotation relative to the starting point of the sample curve used for raycasting.
    A value of false will make the line visual stay at a fixed reference frame rather than bending or curving towards the end of the raycast line.

    controlPointDistance

    Increase this value will make the peak of the curve further from the start point.

    Declaration
    public float controlPointDistance { get; set; }
    Property Value
    Type Description
    Single
    See Also
    BezierCurve

    controlPointHeight

    Increase this value will make the peak of the curve higher relative to the start point.

    Declaration
    public float controlPointHeight { get; set; }
    Property Value
    Type Description
    Single
    See Also
    BezierCurve

    enableUIInteraction

    Gets or sets whether this interactor is able to affect UI.

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

    endPointDistance

    Increase this value distance will make the end of curve further from the start point.

    Declaration
    public float endPointDistance { get; set; }
    Property Value
    Type Description
    Single
    See Also
    BezierCurve

    endPointHeight

    Decrease this value will make the end of the curve drop lower relative to the start point.

    Declaration
    public float endPointHeight { get; set; }
    Property Value
    Type Description
    Single
    See Also
    BezierCurve

    hitClosestOnly

    Consider only the closest Interactable as a valid target for interaction.

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

    Enable this to make only the closest Interactable receive hover events. Otherwise, all hit Interactables will be considered valid and this Interactor will multi-hover.

    See Also
    GetValidTargets(List<XRBaseInteractable>)

    hitDetectionType

    Sets which type of hit detection to use for the raycast.

    Declaration
    public XRRayInteractor.HitDetectionType hitDetectionType { get; set; }
    Property Value
    Type Description
    XRRayInteractor.HitDetectionType

    hoverTimeToSelect

    Number of seconds for which this Interactor must hover over an Interactable to select it if Hover To Select is enabled.

    Declaration
    public float hoverTimeToSelect { get; set; }
    Property Value
    Type Description
    Single
    See Also
    hoverToSelect

    hoverToSelect

    Whether this Interactor will automatically select an Interactable after hovering over it for a period of time.

    Declaration
    public bool hoverToSelect { get; set; }
    Property Value
    Type Description
    Boolean
    See Also
    hoverTimeToSelect

    isSelectActive

    Gets whether the selection state is active for this interactor. This will check if the controller has a valid selection state or whether toggle selection is currently on and active.

    Declaration
    public override bool isSelectActive { get; }
    Property Value
    Type Description
    Boolean
    Overrides
    XRBaseControllerInteractor.isSelectActive

    keepSelectedTargetValid

    Whether to keep selecting the target when not pointing to it after initially selecting it. It is recommended to set this value to true for grabbing objects, false for teleportation interactables.

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

    lineType

    Gets or sets the type of ray cast.

    Declaration
    public XRRayInteractor.LineType lineType { get; set; }
    Property Value
    Type Description
    XRRayInteractor.LineType

    maxRaycastDistance

    Gets or sets the max distance of ray cast when the line type is a straight line. Increasing this value will make the line reach further.

    Declaration
    public float maxRaycastDistance { get; set; }
    Property Value
    Type Description
    Single
    See Also
    StraightLine

    originalAttachTransform

    The that upon entering selection (when this interactor first initiates selection of an interactable), this interactor will copy the pose of the attach values into.

    Declaration
    protected Transform originalAttachTransform { get; set; }
    Property Value
    Type Description
    Transform
    Remarks

    Automatically instantiated and set in Awake(). Setting this will not automatically destroy the previous object.

    See Also
    attachTransform

    raycastMask

    Gets or sets layer mask used for limiting raycast targets.

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

    raycastTriggerInteraction

    Gets or sets type of interaction with trigger volumes via raycast.

    Declaration
    public QueryTriggerInteraction raycastTriggerInteraction { get; set; }
    Property Value
    Type Description
    QueryTriggerInteraction

    referenceFrame

    The reference frame of the curve to define the ground plane and up. If not set at startup it will try to find the rig GameObject, and if that does not exist it will use global up and origin by default.

    Declaration
    public Transform referenceFrame { get; set; }
    Property Value
    Type Description
    Transform
    See Also
    ProjectileCurve
    BezierCurve

    rotateSpeed

    Speed that the anchor is rotated.

    Declaration
    public float rotateSpeed { get; set; }
    Property Value
    Type Description
    Single
    See Also
    allowAnchorControl
    translateSpeed

    sampleFrequency

    The number of sample points used to approximate curved paths. Larger values produce a better quality approximate at the cost of reduced performance due to the number of raycasts.

    Declaration
    public int sampleFrequency { get; set; }
    Property Value
    Type Description
    Int32
    Remarks

    A value of n will result in n - 1 line segments for raycast. This property is not used when using StraightLine since the value would always be 2.

    See Also
    ProjectileCurve
    BezierCurve

    sphereCastRadius

    Gets or sets radius used for sphere casting. Will use regular raycasting if set to 0 or less.

    Declaration
    public float sphereCastRadius { get; set; }
    Property Value
    Type Description
    Single
    See Also
    SphereCast

    translateSpeed

    Speed that the anchor is translated.

    Declaration
    public float translateSpeed { get; set; }
    Property Value
    Type Description
    Single
    See Also
    allowAnchorControl
    rotateSpeed

    useForceGrab

    Force grab moves the object to your hand rather than interacting with it at a distance.

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

    validTargets

    (Read Only) A list of Interactables that this Interactor could possibly interact with this frame.

    Declaration
    protected override List<XRBaseInteractable> validTargets { get; }
    Property Value
    Type Description
    List<XRBaseInteractable>
    Overrides
    XRBaseControllerInteractor.validTargets
    See Also
    GetValidTargets(List<XRBaseInteractable>)

    velocity

    Initial velocity of the projectile. Increasing this value will make the curve reach further.

    Declaration
    public float velocity { get; set; }
    Property Value
    Type Description
    Single
    See Also
    ProjectileCurve

    Velocity

    Initial velocity of the projectile. Increasing this value will make the curve reach further.

    Declaration
    public float Velocity { get; set; }
    Property Value
    Type Description
    Single
    See Also
    ProjectileCurve

    Methods

    Awake()

    See .

    Declaration
    protected override void Awake()
    Overrides
    XRBaseControllerInteractor.Awake()

    CanHover(XRBaseInteractable)

    Determines if the interactable is valid for hover this frame.

    Declaration
    public override bool CanHover(XRBaseInteractable interactable)
    Parameters
    Type Name Description
    XRBaseInteractable interactable

    Interactable to check.

    Returns
    Type Description
    Boolean

    Returns true if the interactable can be hovered over this frame.

    Overrides
    XRBaseInteractor.CanHover(XRBaseInteractable)
    See Also
    IsHoverableBy(XRBaseInteractor)

    CanSelect(XRBaseInteractable)

    Determines if the interactable is valid for selection this frame.

    Declaration
    public override bool CanSelect(XRBaseInteractable interactable)
    Parameters
    Type Name Description
    XRBaseInteractable interactable

    Interactable to check.

    Returns
    Type Description
    Boolean

    Returns true if the interactable can be selected this frame.

    Overrides
    XRBaseInteractor.CanSelect(XRBaseInteractable)
    See Also
    IsSelectableBy(XRBaseInteractor)

    GetCurrentRaycastHit(out RaycastHit)

    Gets the first 3D raycast hit, if any raycast hits are available.

    Declaration
    public bool GetCurrentRaycastHit(out RaycastHit raycastHit)
    Parameters
    Type Name Description
    RaycastHit raycastHit
    Returns
    Type Description
    Boolean

    Returns true if a hit occurred, implying the raycast hit information is valid. Otherwise, returns false.

    GetLinePoints(ref Vector3[], out Int32)

    Gets the polygonal chain represented by a list of endpoints which form line segments to approximate the curve. Positions are in world space coordinates.

    Declaration
    public bool GetLinePoints(ref Vector3[] linePoints, out int numPoints)
    Parameters
    Type Name Description
    Vector3[] linePoints

    When this method returns, contains the sample points if successful.

    Int32 numPoints

    When this method returns, contains the number of sample points if successful.

    Returns
    Type Description
    Boolean

    Returns true if the sample points form a valid line, such as by having at least two points. Otherwise, returns false.

    Implements
    ILineRenderable.GetLinePoints(ref Vector3[], out Int32)

    GetLinePoints(ref Vector3[], ref Int32, Int32)

    (Obsolete) Use GetLinePoints(ref Vector3[], out Int32) instead.

    Declaration
    public bool GetLinePoints(ref Vector3[] linePoints, ref int numPoints, int _ = null)
    Parameters
    Type Name Description
    Vector3[] linePoints

    Obsolete.

    Int32 numPoints

    Obsolete.

    Int32 _

    Dummy value to support old function signature.

    Returns
    Type Description
    Boolean

    Obsolete.

    GetValidTargets(List<XRBaseInteractable>)

    Retrieve the list of Interactables that this Interactor could possibly interact with this frame. This list is sorted by priority (with highest priority first).

    Declaration
    public override void GetValidTargets(List<XRBaseInteractable> targets)
    Parameters
    Type Name Description
    List<XRBaseInteractable> targets

    The results list to populate with Interactables that are valid for selection or hover.

    Overrides
    XRBaseInteractor.GetValidTargets(List<XRBaseInteractable>)

    OnDisable()

    See .

    Declaration
    protected override void OnDisable()
    Overrides
    XRBaseInteractor.OnDisable()

    OnDrawGizmosSelected()

    See .

    Declaration
    protected virtual void OnDrawGizmosSelected()

    OnEnable()

    See .

    Declaration
    protected override void OnEnable()
    Overrides
    XRBaseInteractor.OnEnable()

    OnSelectEntering(SelectEnterEventArgs)

    This method is called by the Interaction Manager right before the Interactor first initiates selection of an Interactable in a first pass.

    Declaration
    protected override void OnSelectEntering(SelectEnterEventArgs args)
    Parameters
    Type Name Description
    SelectEnterEventArgs args

    Event data containing the Interactable that is being selected.

    Overrides
    XRBaseControllerInteractor.OnSelectEntering(SelectEnterEventArgs)
    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnSelectEntered(SelectEnterEventArgs)

    OnSelectExiting(SelectExitEventArgs)

    This method is called by the Interaction Manager right before the Interactor ends selection of an Interactable in a first pass.

    Declaration
    protected override void OnSelectExiting(SelectExitEventArgs args)
    Parameters
    Type Name Description
    SelectExitEventArgs args

    Event data containing the Interactable that is no longer selected.

    Overrides
    XRBaseControllerInteractor.OnSelectExiting(SelectExitEventArgs)
    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnSelectExited(SelectExitEventArgs)

    OnValidate()

    See .

    Declaration
    protected void OnValidate()

    ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)

    This method is called by the Interaction Manager to update the Interactor. Please see the Interaction Manager documentation for more details on update order.

    Declaration
    public override void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
    Parameters
    Type Name Description
    XRInteractionUpdateOrder.UpdatePhase updatePhase

    The update phase this is called during.

    Overrides
    XRBaseControllerInteractor.ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)

    RotateAnchor(Transform, Single)

    Rotates the attach anchor for this interactor. This can be useful to rotate a held object.

    Declaration
    protected virtual void RotateAnchor(Transform anchor, float directionAmount)
    Parameters
    Type Name Description
    Transform anchor

    The attach transform of the interactor.

    Single directionAmount

    The rotation amount.

    TranslateAnchor(Transform, Transform, Single)

    Translates the attach anchor for this interactor. This can be useful to move a held object closer or further away from the interactor.

    Declaration
    protected virtual void TranslateAnchor(Transform originalAnchor, Transform anchor, float directionAmount)
    Parameters
    Type Name Description
    Transform originalAnchor

    The original attach transform of the interactor.

    Transform anchor

    The attach transform of the interactor.

    Single directionAmount

    The translation amount.

    TryGetCurrent3DRaycastHit(out RaycastHit)

    Gets the first 3D raycast hit, if any raycast hits are available.

    Declaration
    public bool TryGetCurrent3DRaycastHit(out RaycastHit raycastHit)
    Parameters
    Type Name Description
    RaycastHit raycastHit
    Returns
    Type Description
    Boolean

    Returns true if a hit occurred, implying the raycast hit information is valid. Otherwise, returns false.

    TryGetCurrent3DRaycastHit(out RaycastHit, out Int32)

    Gets the first 3D raycast hit, if any raycast hits are available.

    Declaration
    public bool TryGetCurrent3DRaycastHit(out RaycastHit raycastHit, out int raycastEndpointIndex)
    Parameters
    Type Name Description
    RaycastHit raycastHit

    When this method returns, contains the raycast hit if available; otherwise, the default value.

    Int32 raycastEndpointIndex

    When this method returns, contains the index of the sample endpoint if a hit occurred. Otherwise, a value of 0 if no hit occurred.

    Returns
    Type Description
    Boolean

    Returns true if a hit occurred, implying the raycast hit information is valid. Otherwise, returns false.

    TryGetCurrentRaycast(out Nullable<RaycastHit>, out Int32, out Nullable<RaycastResult>, out Int32, out Boolean)

    Gets the first 3D and UI raycast hits, if any raycast hits are available.

    Declaration
    public bool TryGetCurrentRaycast(out RaycastHit? raycastHit, out int raycastHitIndex, out RaycastResult? uiRaycastHit, out int uiRaycastHitIndex, out bool isUIHitClosest)
    Parameters
    Type Name Description
    Nullable<RaycastHit> raycastHit

    When this method returns, contains the raycast hit if available; otherwise, the default value.

    Int32 raycastHitIndex

    When this method returns, contains the index of the sample endpoint if a hit occurred. Otherwise, a value of 0 if no hit occurred.

    Nullable<RaycastResult> uiRaycastHit

    When this method returns, contains the UI raycast result if available; otherwise, the default value.

    Int32 uiRaycastHitIndex

    When this method returns, contains the index of the sample endpoint if a hit occurred. Otherwise, a value of 0 if no hit occurred.

    Boolean isUIHitClosest

    When this method returns, contains whether the UI raycast result was the closest hit.

    Returns
    Type Description
    Boolean

    Returns true if either hit occurred, implying the raycast hit information is valid. Otherwise, returns false.

    TryGetCurrentUIRaycastResult(out RaycastResult)

    Gets the first UI raycast result, if any raycast results are available.

    Declaration
    public bool TryGetCurrentUIRaycastResult(out RaycastResult raycastResult)
    Parameters
    Type Name Description
    RaycastResult raycastResult
    Returns
    Type Description
    Boolean

    Returns true if a hit occurred, implying the raycast hit information is valid. Otherwise, returns false.

    TryGetCurrentUIRaycastResult(out RaycastResult, out Int32)

    Gets the first UI raycast result, if any raycast results are available.

    Declaration
    public bool TryGetCurrentUIRaycastResult(out RaycastResult raycastResult, out int raycastEndpointIndex)
    Parameters
    Type Name Description
    RaycastResult raycastResult

    When this method returns, contains the UI raycast result if available; otherwise, the default value.

    Int32 raycastEndpointIndex

    When this method returns, contains the index of the sample endpoint if a hit occurred. Otherwise, a value of 0 if no hit occurred.

    Returns
    Type Description
    Boolean

    Returns true if a hit occurred, implying the raycast hit information is valid. Otherwise, returns false.

    TryGetHitInfo(out Vector3, out Vector3, out Int32, out Boolean)

    Gets the current raycast hit information, if a hit occurred. It will return the world position and the normal vector of the hit point, and its position in linePoints.

    Declaration
    public bool TryGetHitInfo(out Vector3 position, out Vector3 normal, out int positionInLine, out bool isValidTarget)
    Parameters
    Type Name Description
    Vector3 position

    When this method returns, contains the world position of the ray impact point if a hit occurred.

    Vector3 normal

    When this method returns, contains the world normal of the surface the ray hit if a hit occurred.

    Int32 positionInLine

    When this method returns, contains the index of the sample endpoint within the list of points returned by GetLinePoints(ref Vector3[], out Int32) where a hit occurred. Otherwise, a value of 0 if no hit occurred.

    Boolean isValidTarget

    When this method returns, contains whether both a hit occurred and it is a valid target for interaction.

    Returns
    Type Description
    Boolean

    Returns true if a hit occurred, implying the raycast hit information is valid. Otherwise, returns false.

    Implements
    ILineRenderable.TryGetHitInfo(out Vector3, out Vector3, out Int32, out Boolean)

    TryGetHitInfo(ref Vector3, ref Vector3, ref Int32, ref Boolean, Int32)

    (Obsolete) Use TryGetHitInfo(out Vector3, out Vector3, out Int32, out Boolean) instead.

    Declaration
    public bool TryGetHitInfo(ref Vector3 position, ref Vector3 normal, ref int positionInLine, ref bool isValidTarget, int _ = null)
    Parameters
    Type Name Description
    Vector3 position

    Obsolete.

    Vector3 normal

    Obsolete.

    Int32 positionInLine

    Obsolete.

    Boolean isValidTarget

    Obsolete.

    Int32 _

    Dummy value to support old function signature.

    Returns
    Type Description
    Boolean

    Obsolete.

    TryGetUIModel(out TrackedDeviceModel)

    Attempts to retrieve the current UI Model.

    Declaration
    public bool TryGetUIModel(out TrackedDeviceModel model)
    Parameters
    Type Name Description
    TrackedDeviceModel model

    The returned model that reflects the UI state of this Interactor.

    Returns
    Type Description
    Boolean

    Returns true if the model was able to retrieved. Otherwise, returns false.

    Implements
    IUIInteractor.TryGetUIModel(out TrackedDeviceModel)

    UpdateUIModel(ref TrackedDeviceModel)

    Updates the current UI Model to match the state of the Interactor.

    Declaration
    public virtual void UpdateUIModel(ref TrackedDeviceModel model)
    Parameters
    Type Name Description
    TrackedDeviceModel model

    The returned model that will match this Interactor.

    Implements
    IUIInteractor.UpdateUIModel(ref TrackedDeviceModel)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023