Struct ARRaycastHit | AR Foundation | 2.2.0-preview.6
docs.unity3d.com
    Show / Hide Table of Contents

    Struct ARRaycastHit

    Represents the result of a raycast intersection with a trackable.

    Namespace: UnityEngine.XR.ARFoundation
    Syntax
    public struct ARRaycastHit : IEquatable<ARRaycastHit>, IComparable<ARRaycastHit>

    Constructors

    ARRaycastHit(XRRaycastHit, Single, Transform)

    Constructor invoked by the methods.

    Declaration
    public ARRaycastHit(XRRaycastHit hit, float distance, Transform transform)
    Parameters
    Type Name Description
    XRRaycastHit hit

    Session-relative raycast hit data.

    Single distance

    The distance, in Unity world space, of the hit.

    Transform transform

    The Transform that transforms from session space to world space.

    Properties

    distance

    The distance, in Unity world space, from the ray origin to the intersection point.

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

    hitType

    The type of trackable hit by the raycast.

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

    pose

    The Pose, in Unity world space, of the intersection point.

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

    sessionRelativeDistance

    The distance, in local (session) space, from the ray origin to the intersection point.

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

    sessionRelativePose

    The Pose, in local (session) space, of the intersection point.

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

    trackableId

    The session-unique identifier for the trackable that was hit.

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

    Methods

    CompareTo(ARRaycastHit)

    Declaration
    public int CompareTo(ARRaycastHit other)
    Parameters
    Type Name Description
    ARRaycastHit other
    Returns
    Type Description
    Int32

    Equals(Object)

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

    Equals(ARRaycastHit)

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

    GetHashCode()

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

    Operators

    Equality(ARRaycastHit, ARRaycastHit)

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

    Inequality(ARRaycastHit, ARRaycastHit)

    Declaration
    public static bool operator !=(ARRaycastHit lhs, ARRaycastHit rhs)
    Parameters
    Type Name Description
    ARRaycastHit lhs
    ARRaycastHit rhs
    Returns
    Type Description
    Boolean
    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