docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct XRRaycast

    Represents the intersection of a raycast with a trackable.

    Implements
    ITrackable
    IEquatable<XRRaycast>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.ARSubsystems
    Assembly: Unity.XR.ARSubsystems.dll
    Syntax
    public struct XRRaycast : ITrackable, IEquatable<XRRaycast>

    Constructors

    XRRaycast(TrackableId, Pose, TrackingState, IntPtr, float, TrackableId)

    Constructs an XRRaycast.

    Declaration
    public XRRaycast(TrackableId trackableId, Pose pose, TrackingState trackingState, IntPtr nativePtr, float distance, TrackableId hitTrackableId)
    Parameters
    Type Name Description
    TrackableId trackableId

    The TrackableId of the trackable which was hit.

    Pose pose

    The session-space Pose of the intersection.

    TrackingState trackingState

    The tracking state of this raycast.

    IntPtr nativePtr

    A pointer into native memory for this raycast.

    float distance

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

    TrackableId hitTrackableId

    The TrackableId of the trackable hit by this raycast, or invalidId if none.

    Properties

    defaultValue

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

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

    distance

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

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

    hitTrackableId

    The TrackableId of the trackable hit by this raycast, or invalidId if none.

    Declaration
    public TrackableId hitTrackableId { get; }
    Property Value
    Type Description
    TrackableId

    nativePtr

    The pointer associated with this raycast. The data this pointer points to is implementation-defined. Refer to the platform-specific AR package for details.

    Declaration
    public IntPtr nativePtr { get; }
    Property Value
    Type Description
    IntPtr

    pose

    The session-space Pose of this raycast's intersection with a target.

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

    trackableId

    A unique identifier for this raycast.

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

    trackingState

    The TrackingState of this raycast.

    Declaration
    public TrackingState trackingState { get; }
    Property Value
    Type Description
    TrackingState

    Methods

    Equals(object)

    Compares this raycast for equality with an object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare for equality.

    Returns
    Type Description
    bool

    True if obj is a XRRaycast and compares Equals(XRRaycast).

    Overrides
    ValueType.Equals(object)

    Equals(XRRaycast)

    Compares this raycast for equality with another raycast.

    Declaration
    public bool Equals(XRRaycast other)
    Parameters
    Type Name Description
    XRRaycast other

    The raycast with which to compare.

    Returns
    Type Description
    bool

    True if all fields of both raycasts are equal. Otherwise, false.

    GetHashCode()

    Computes a hash suitable for use in a Dictionary or HashSet.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code computed from this raycast's fields.

    Overrides
    ValueType.GetHashCode()

    Operators

    operator ==(XRRaycast, XRRaycast)

    Tests for equality between two XRRaycasts. Same as lhs.Equals(rhs)

    Declaration
    public static bool operator ==(XRRaycast lhs, XRRaycast rhs)
    Parameters
    Type Name Description
    XRRaycast lhs

    The left-hand side of the comparison.

    XRRaycast rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    bool

    True if all fields of both lhs and rhs are equal.

    operator !=(XRRaycast, XRRaycast)

    Tests for inequality between two XRRaycasts. Same as !lhs.Equals(rhs)

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

    The left-hand side of the comparison.

    XRRaycast rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    bool

    True if any of the fields of lhs and rhs are not equal.

    Implements

    ITrackable
    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2024 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)