Struct XRRaycastHit | AR Subsystems | 3.1.10
docs.unity3d.com
    Show / Hide Table of Contents

    Struct XRRaycastHit

    Represents the intersection of a raycast with a trackable.

    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    public struct XRRaycastHit : IEquatable<XRRaycastHit>

    Constructors

    XRRaycastHit(TrackableId, Pose, Single, TrackableType)

    Constructs an XRRaycastHit.

    Declaration
    public XRRaycastHit(TrackableId trackableId, Pose pose, float distance, TrackableType hitType)
    Parameters
    Type Name Description
    TrackableId trackableId

    The TrackableId of the trackable which was hit.

    Pose pose

    The session-space Pose of the intersection.

    Single distance

    The session-space distance from the raycast origin to the intersection point.

    TrackableType hitType

    The type(s) of trackables which were hit by the ray.

    Properties

    defaultValue

    A default-initialized raycast hit. This may be different from a zero-initialized raycast hit.

    Declaration
    public static XRRaycastHit defaultValue { get; }
    Property Value
    Type Description
    XRRaycastHit

    distance

    The session-space distance from the raycast origin to the intersection point.

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

    hitType

    The type(s) of trackables which were hit by the ray.

    Declaration
    public TrackableType hitType { get; set; }
    Property Value
    Type Description
    TrackableType

    pose

    The session-space Pose of the intersection.

    Declaration
    public Pose pose { get; set; }
    Property Value
    Type Description
    Pose

    trackableId

    The TrackableId of the trackable which was hit. This may be invalidId as not all trackables have ids, e.g., feature points.

    Declaration
    public TrackableId trackableId { get; set; }
    Property Value
    Type Description
    TrackableId

    Methods

    Equals(Object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj
    Returns
    Type Description
    Boolean
    Overrides
    ValueType.Equals(Object)

    Equals(XRRaycastHit)

    Declaration
    public bool Equals(XRRaycastHit other)
    Parameters
    Type Name Description
    XRRaycastHit other
    Returns
    Type Description
    Boolean

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32
    Overrides
    ValueType.GetHashCode()

    Operators

    Equality(XRRaycastHit, XRRaycastHit)

    Declaration
    public static bool operator ==(XRRaycastHit lhs, XRRaycastHit rhs)
    Parameters
    Type Name Description
    XRRaycastHit lhs
    XRRaycastHit rhs
    Returns
    Type Description
    Boolean

    Inequality(XRRaycastHit, XRRaycastHit)

    Declaration
    public static bool operator !=(XRRaycastHit lhs, XRRaycastHit rhs)
    Parameters
    Type Name Description
    XRRaycastHit lhs
    XRRaycastHit rhs
    Returns
    Type Description
    Boolean

    See Also

    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)
    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