C Specification

The XrSpatialRaycastResultDataANDROID structure is defined as:

// Provided by XR_ANDROID_spatial_discovery_raycast
typedef struct XrSpatialRaycastResultDataANDROID {
    XrPosef    hitPose;
    float      distanceSquared;
} XrSpatialRaycastResultDataANDROID;

Members

Member Descriptions
  • hitPose is an XrPosef defining the point where the ray intersects with the spatial entity.

  • distanceSquared is the squared of the distance from origin of the ray to the intersection point.

Description

The XR_SPATIAL_COMPONENT_TYPE_RAYCAST_RESULT_ANDROID component will only be present in an XrSpatialSnapshotEXT created from xrCreateSpatialDiscoverySnapshotAsyncEXT where XrSpatialRaycastInfoANDROID is included in the XrSpatialDiscoverySnapshotCreateInfoEXT::next chain or in an XrSpatialSnapshotEXT created from xrCreateSpatialRaycastSnapshotANDROID.

The runtime must not include this component in any XrSpatialSnapshotEXT that is created using xrCreateSpatialUpdateSnapshotEXT.

The runtime must return XR_ERROR_VALIDATION_FAILURE from xrCreateSpatialUpdateSnapshotEXT if the application includes XR_SPATIAL_COMPONENT_TYPE_RAYCAST_RESULT_ANDROID in XrSpatialUpdateSnapshotCreateInfoEXT::componentTypes.

If XR_SPATIAL_COMPONENT_TYPE_RAYCAST_RESULT_ANDROID is enabled only for certain capabilities, the runtime must include only spatial entities provided by those capabilities in the snapshot. For example, if an object and a plane lines up in the same direction and XR_SPATIAL_COMPONENT_TYPE_RAYCAST_RESULT_ANDROID is enabled only for XR_SPATIAL_CAPABILITY_PLANE_TRACKING_EXT, only the plane will be discovered.

The hitPose of the XR_SPATIAL_COMPONENT_TYPE_RAYCAST_RESULT_ANDROID will be located in XrCreateSpatialDiscoverySnapshotCompletionInfoEXT::baseSpace at XrCreateSpatialDiscoverySnapshotCompletionInfoEXT::time. The positive Z axis is the normal of the hit surface, and the negative Y axis roughly points toward the ray origin.

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.