docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct XrSpatialRaycastResultDataANDROID

    The raycast result component, which describes where a ray hit a spatial entity. Provided by XR_ANDROID_spatial_discovery_raycast.

    Implements
    IEquatable<XrSpatialRaycastResultDataANDROID>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.OpenXR.NativeTypes
    Assembly: Unity.XR.OpenXR.dll
    Syntax
    public readonly struct XrSpatialRaycastResultDataANDROID : IEquatable<XrSpatialRaycastResultDataANDROID>

    Constructors

    XrSpatialRaycastResultDataANDROID(XrPosef, float)

    Construct an instance.

    Declaration
    public XrSpatialRaycastResultDataANDROID(XrPosef hitPose, float distanceSquared)
    Parameters
    Type Name Description
    XrPosef hitPose

    The pose defining the point where the ray intersects with the spatial entity.

    float distanceSquared

    The square of the distance from the origin of the ray to the intersection point.

    Properties

    distanceSquared

    The square of the distance from the origin of the ray to the intersection point.

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

    hitPose

    The pose defining the point where the ray intersects with the spatial entity. The positive Z axis is the normal of the hit surface, and the negative Y axis roughly points toward the ray origin.

    Declaration
    public XrPosef hitPose { get; }
    Property Value
    Type Description
    XrPosef
    Remarks

    The space and time this pose is located in depend on how the snapshot was created:

    • For a snapshot from `OpenXRNativeApi.xrCreateSpatialDiscoverySnapshotAsyncEXT`, the pose is located in `XrCreateSpatialDiscoverySnapshotCompletionInfoEXT.baseSpace` at that struct's `time`.
    • For a snapshot from `OpenXRNativeApi.xrCreateSpatialRaycastSnapshotANDROID`, there is no completion info. The pose is located in space at time.

    Methods

    Equals(object)

    Compares for equality. Two instances are equal if their hitPose and distanceSquared properties are exactly equal.

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

    The other object.

    Returns
    Type Description
    bool

    true if obj is an XrSpatialRaycastResultDataANDROID and equal to this instance. Otherwise, false.

    Overrides
    ValueType.Equals(object)

    Equals(XrSpatialRaycastResultDataANDROID)

    Compares for equality. Two instances are equal if their hitPose and distanceSquared properties are exactly equal.

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

    The other instance.

    Returns
    Type Description
    bool

    true if the instances are equal, otherwise false.

    GetHashCode()

    Generates a unique hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    The hash code.

    Overrides
    ValueType.GetHashCode()

    Implements

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