Struct XrSpatialRaycastResultDataANDROID
The raycast result component, which describes where a ray hit a spatial entity.
Provided by XR_ANDROID_spatial_discovery_raycast.
Implements
Inherited Members
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 |
|
Overrides
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 |
|
GetHashCode()
Generates a unique hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | The hash code. |