Struct EnvironmentRaycastHit
Represents a potential raycast intersection with the environment, including a provider-specific hitStatus which indicates a hit or miss.
Implements
Inherited Members
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 |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
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 |
|
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
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 |
|
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 |
|
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 |
|