C Specification
Applications use the xrCreateSpatialAnchorEXT function to create an anchor. If an application wants to create an entity-bound anchor that is attached to a spatial entity, it can chain an XrSpatialAnchorParentANDROID structure to the next pointer of the XrSpatialAnchorCreateInfoEXT structure when calling the xrCreateSpatialAnchorEXT function.
The XrSpatialAnchorParentANDROID structure is defined as:
// Provided by XR_ANDROID_spatial_entity_bound_anchor
typedef struct XrSpatialAnchorParentANDROID {
XrStructureType type;
const void* next;
XrSpatialEntityIdEXT parentId;
} XrSpatialAnchorParentANDROID;
Members
Description
The runtime must guaranteed that the distance between the parent entity and the anchor is always consistent, where the distance is the anchor’s pose to the nearest surface of the parent entity along the surface’s normal. The pose of the anchor is updated based on the parent entity’s position and the distance to the parent entity’s surface regardless of how many attachable components the parent entity has.
The runtime must return XR_ERROR_SPATIAL_ENTITY_ID_INVALID_EXT from
xrCreateSpatialAnchorEXT if
XrSpatialAnchorParentANDROID::parentId is not a valid ID for
xrCreateSpatialAnchorEXT::spatialContext.
The runtime must return
XR_ERROR_SPATIAL_ANCHOR_ATTACHABLE_COMPONENT_NOT_FOUND_ANDROID from
xrCreateSpatialAnchorEXT if none of the components enumerated by
xrEnumerateSpatialAnchorAttachableComponentsANDROID are on the parent
entity.
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
Copyright 2014-2026 The Khronos Group Inc.
This work is licensed under a Creative Commons Attribution 4.0 International License.