Struct XrSpatialRaycastInfoANDROID
Describes a ray used to discover spatial entities that intersect with it. Include this struct in the
next chain, or reference it from
raycastInfo.
Provided by XR_ANDROID_spatial_discovery_raycast.
Inherited Members
Namespace: UnityEngine.XR.OpenXR.NativeTypes
Assembly: Unity.XR.OpenXR.dll
Syntax
public readonly struct XrSpatialRaycastInfoANDROID
Remarks
The spatial context must have RaycastResult enabled for at least one capability, otherwise snapshot creation fails with SpatialComponentNotEnabledEXT.
Warning
Don't initialize this struct with the default parameterless constructor. Use a constructor with parameters to ensure that type is correctly initialized to SpatialRaycastInfoANDROID.
Constructors
XrSpatialRaycastInfoANDROID(ulong, long, XrVector3f, XrVector3f)
Construct an instance with a null next pointer and an unbounded ray.
Declaration
public XrSpatialRaycastInfoANDROID(ulong space, long time, XrVector3f origin, XrVector3f direction)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | space | The space in which the raycast result pose will be located. |
| long | time | The time at which the raycast result pose is defined. |
| XrVector3f | origin | The origin of the ray, relative to the specified space. |
| XrVector3f | direction | The direction of the ray, relative to the specified space. |
XrSpatialRaycastInfoANDROID(ulong, long, XrVector3f, XrVector3f, float)
Construct an instance with a null next pointer.
Declaration
public XrSpatialRaycastInfoANDROID(ulong space, long time, XrVector3f origin, XrVector3f direction, float maxDistance)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | space | The space in which the raycast result pose will be located. |
| long | time | The time at which the raycast result pose is defined. |
| XrVector3f | origin | The origin of the ray, relative to the specified space. |
| XrVector3f | direction | The direction of the ray, relative to the specified space. |
| float | maxDistance | The maximum distance in meters, or |
XrSpatialRaycastInfoANDROID(void*, ulong, long, XrVector3f, XrVector3f, float)
Construct an instance.
Declaration
public XrSpatialRaycastInfoANDROID(void* next, ulong space, long time, XrVector3f origin, XrVector3f direction, float maxDistance)
Parameters
| Type | Name | Description |
|---|---|---|
| void* | next | The next pointer. |
| ulong | space | The space in which the raycast result pose will be located. |
| long | time | The time at which the raycast result pose is defined. |
| XrVector3f | origin | The origin of the ray, relative to the specified space. |
| XrVector3f | direction | The direction of the ray, relative to the specified space. |
| float | maxDistance | The maximum distance in meters, or |
Properties
direction
The direction of the ray, relative to the specified space.
Declaration
public XrVector3f direction { get; }
Property Value
| Type | Description |
|---|---|
| XrVector3f |
maxDistance
The distance in meters used to limit discovery to entities within that distance from
origin, along direction. If this value is 0 or negative,
the runtime considers the ray unbounded.
Declaration
public float maxDistance { get; }
Property Value
| Type | Description |
|---|---|
| float |
next
null or a pointer to the next structure in a structure chain.
No such structures are defined in core OpenXR or this extension.
Declaration
public void* next { get; }
Property Value
| Type | Description |
|---|---|
| void* |
origin
The origin of the ray, relative to the specified space.
Declaration
public XrVector3f origin { get; }
Property Value
| Type | Description |
|---|---|
| XrVector3f |
space
The XrSpace in which the pose of XrSpatialRaycastResultDataANDROID will be located.
Declaration
public ulong space { get; }
Property Value
| Type | Description |
|---|---|
| ulong |
time
The time at which the pose of XrSpatialRaycastResultDataANDROID is defined.
Declaration
public long time { get; }
Property Value
| Type | Description |
|---|---|
| long |
type
The XrStructureType of this struct: SpatialRaycastInfoANDROID.
Declaration
public XrStructureType type { get; }
Property Value
| Type | Description |
|---|---|
| XrStructureType |
Methods
TryCreate(XrVector3f, XrVector3f, float, out XrSpatialRaycastInfoANDROID)
Try to construct an instance using your app space and the next frame's predicted display time, so that you don't need to supply space and time.
Declaration
public static bool TryCreate(XrVector3f origin, XrVector3f direction, float maxDistance, out XrSpatialRaycastInfoANDROID info)
Parameters
| Type | Name | Description |
|---|---|---|
| XrVector3f | origin | The origin of the ray, in session space relative to your app space (XR Origin), not Unity world space. |
| XrVector3f | direction | The direction of the ray, in session space relative to your app space (XR Origin), not Unity world space. |
| float | maxDistance | The maximum distance in meters, or |
| XrSpatialRaycastInfoANDROID | info | The constructed instance, if this method returns |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
The app space and time only become available once the OpenXR provider is running and has
completed a frame. Before then this method returns false.