docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct EnvironmentRaycastHit

    Represents a potential raycast intersection with the environment, including a provider-specific hitStatus which indicates a hit or miss.

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

    Constructors

    EnvironmentRaycastHit(EnvironmentRaycastHitStatus, XRRaycastHit)

    Constructs an EnvironmentRaycastHit.

    Declaration
    public EnvironmentRaycastHit(EnvironmentRaycastHitStatus hitStatus, XRRaycastHit hit)
    Parameters
    Type Name Description
    EnvironmentRaycastHitStatus hitStatus

    The environmental raycast hit status of the environment intersection.

    XRRaycastHit hit

    The XRRaycastHit of the intersection with the environment.

    Fields

    defaultValue

    A default-initialized environment raycast hit, using Pose.identity instead of zero-initialization.

    Declaration
    public static EnvironmentRaycastHit defaultValue
    Field Value
    Type Description
    EnvironmentRaycastHit

    Properties

    hit

    The XR Raycast Hit against the environment. Should only be read if IsHit() returns true.

    Declaration
    public XRRaycastHit hit { get; }
    Property Value
    Type Description
    XRRaycastHit

    hitStatus

    The Environment Raycast Hit Status that gives additional info about the hit. Should only be read if IsHit() returns true.

    Declaration
    public EnvironmentRaycastHitStatus hitStatus { get; }
    Property Value
    Type Description
    EnvironmentRaycastHitStatus

    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 EnvironmentRaycastHit and Equals(EnvironmentRaycastHit) also returns true. Otherwise, false.

    Overrides
    ValueType.Equals(object)

    Equals(EnvironmentRaycastHit)

    Tests for equality.

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

    The other EnvironmentRaycastHit to compare against.

    Returns
    Type Description
    bool

    true if every field in other is equal to this EnvironmentRaycastHit. Otherwise, false.

    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()

    IsHit()

    Is this hit considered a valid hit, also read as "did the raycast hit the environment?"

    Declaration
    public bool IsHit()
    Returns
    Type Description
    bool

    true if this is considered a hit, and the pose can be read. Otherwise, false.

    Operators

    operator ==(EnvironmentRaycastHit, EnvironmentRaycastHit)

    Tests for equality. Same as Equals(EnvironmentRaycastHit).

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

    The left-hand side of the comparison.

    EnvironmentRaycastHit rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    bool

    true if lhs is equal to rhs. Otherwise, false.

    operator !=(EnvironmentRaycastHit, EnvironmentRaycastHit)

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

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

    The left-hand side of the comparison.

    EnvironmentRaycastHit rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    bool

    true if lhs is not equal to rhs. Otherwise, false.

    Implements

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