C Specification

The XrSpatialRaycastInfoANDROID structure is defined as:

// Provided by XR_ANDROID_spatial_discovery_raycast
typedef struct XrSpatialRaycastInfoANDROID {
    XrStructureType    type;
    const void*        next;
    XrSpace            space;
    XrTime             time;
    XrVector3f         origin;
    XrVector3f         direction;
    float              maxDistance;
} XrSpatialRaycastInfoANDROID;

Members

Member Descriptions
  • type is the XrStructureType of this structure.

  • next is NULL or a pointer to the next structure in a structure chain.

  • space is the XrSpace in which the pose of XrSpatialRaycastResultDataANDROID will be located.

  • time is an XrTime at which the pose of XrSpatialRaycastResultDataANDROID defined.

  • origin is an XrVector3f which describes the origin of the ray.

  • direction is an XrVector3f which describes the direction of the ray.

  • maxDistance is the distance in meters that application can optionally specify to limit the discovery of entities that are within the specified distance from the origin, along direction.

Description

An application can include XrSpatialRaycastInfoANDROID in the XrSpatialDiscoverySnapshotCreateInfoEXT::next chain to discover spatial entities that intersect with the ray defined in this struct.

If an application uses XrSpatialRaycastInfoANDROID with an XrSpatialContextEXT that was configured without enabling XR_SPATIAL_COMPONENT_TYPE_RAYCAST_RESULT_ANDROID for any capability, the runtime must return XR_ERROR_SPATIAL_COMPONENT_NOT_ENABLED_EXT from xrCreateSpatialDiscoverySnapshotAsyncEXT or xrCreateSpatialRaycastSnapshotANDROID.

The runtime must include the component data and ids of only those spatial entities in XrSpatialSnapshotEXT that come from capabilities that support the XR_SPATIAL_COMPONENT_TYPE_RAYCAST_RESULT_ANDROID component.

If an application sets maxDistance to a positive value, the runtime must not include any hit spatial entities in the snapshot that are more than maxDistance away from the panme:origin along direction. If maxDistance is set to 0 or a negative value, the runtime must consider the ray unbounded.

Valid Usage (Implicit)

See Also

Document Notes

For more information, see the OpenXR Specification

This page is extracted from the OpenXR Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2026 The Khronos Group Inc.