docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct XRRaycastHit

    Represents the intersection of a raycast with a trackable.

    Implements
    IEquatable<XRRaycastHit>
    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 XRRaycastHit : IEquatable<XRRaycastHit>

    Constructors

    XRRaycastHit(TrackableId, Pose, float, 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.

    float distance

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

    TrackableType hitType

    The types of trackables which were hit by the ray.

    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    Properties

    defaultValue

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

    Declaration
    public static XRRaycastHit defaultValue { get; }
    Property Value
    Type Description
    XRRaycastHit
    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    distance

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

    Declaration
    public float distance { get; set; }
    Property Value
    Type Description
    float
    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    hitType

    The types of trackables which were hit by the ray.

    Declaration
    public TrackableType hitType { get; set; }
    Property Value
    Type Description
    TrackableType
    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    pose

    The session-space Pose of the intersection.

    Declaration
    public Pose pose { get; set; }
    Property Value
    Type Description
    Pose
    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    trackableId

    The TrackableId of the trackable which was hit. This can be invalidId as some trackables (for example, feature points) don't have ids.

    Declaration
    public TrackableId trackableId { get; set; }
    Property Value
    Type Description
    TrackableId
    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    Methods

    Equals(object)

    Tests for equality.

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

    The object to compare against.

    Returns
    Type Description
    bool

    True if obj is of type XRRaycastHit and Equals(XRRaycastHit) also returns true; otherwise false.

    Overrides
    ValueType.Equals(object)
    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    Equals(XRRaycastHit)

    Tests for equality.

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

    The other XRRaycastHit to compare against.

    Returns
    Type Description
    bool

    True if every field in other is equal to this XRRaycastHit, otherwise false.

    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    GetHashCode()

    Generates a hash suitable for use with containers like HashSet and Dictionary.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code generated from this object's fields.

    Overrides
    ValueType.GetHashCode()
    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    Operators

    operator ==(XRRaycastHit, XRRaycastHit)

    Tests for equality. Same as Equals(XRRaycastHit).

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

    The left-hand side of the comparison.

    XRRaycastHit rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    bool

    True if lhs is equal to rhs, otherwise false.

    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    operator !=(XRRaycastHit, XRRaycastHit)

    Tests for inequality. Same as !Equals(XRRaycastHit).

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

    The left-hand side of the comparison.

    XRRaycastHit rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    bool

    True if lhs is not equal to rhs, otherwise false.

    See Also
    Raycast(Ray, TrackableType, Allocator)
    Raycast(Vector2, TrackableType, Allocator)

    Implements

    IEquatable<T>

    See Also

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