Class MSFTSpatialAnchor
This extension allows an application to create a spatial anchor, an arbitrary freespace point in the user’s physical environment that will then be tracked by the runtime. The runtime should then adjust the position and orientation of that anchor’s origin over time as needed, independently of all other spaces and anchors, to ensure that it maintains its original mapping to the real world.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intExtendsXrResult.static final StringThe extension name.static final intThe extension specification version.static final intExtendsXrObjectType.static final intExtendsXrStructureType.static final intExtendsXrStructureType. -
Method Summary
Modifier and TypeMethodDescriptionstatic intnxrCreateSpatialAnchorMSFT(XrSession session, long createInfo, long anchor) Unsafe version of:CreateSpatialAnchorMSFTstatic intnxrCreateSpatialAnchorSpaceMSFT(XrSession session, long createInfo, long space) Unsafe version of:CreateSpatialAnchorSpaceMSFTstatic intxrCreateSpatialAnchorMSFT(XrSession session, XrSpatialAnchorCreateInfoMSFT createInfo, org.lwjgl.PointerBuffer anchor) Creates a spatial anchor.static intxrCreateSpatialAnchorSpaceMSFT(XrSession session, XrSpatialAnchorSpaceCreateInfoMSFT createInfo, org.lwjgl.PointerBuffer space) Creates a space from a spatial anchor.static intDestroys a spatial anchor.
-
Field Details
-
XR_MSFT_spatial_anchor_SPEC_VERSION
public static final int XR_MSFT_spatial_anchor_SPEC_VERSIONThe extension specification version.- See Also:
-
XR_MSFT_SPATIAL_ANCHOR_EXTENSION_NAME
The extension name.- See Also:
-
XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_MSFT
public static final int XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_MSFTExtendsXrStructureType.Enum values:
- See Also:
-
XR_TYPE_SPATIAL_ANCHOR_SPACE_CREATE_INFO_MSFT
public static final int XR_TYPE_SPATIAL_ANCHOR_SPACE_CREATE_INFO_MSFTExtendsXrStructureType.Enum values:
- See Also:
-
XR_OBJECT_TYPE_SPATIAL_ANCHOR_MSFT
public static final int XR_OBJECT_TYPE_SPATIAL_ANCHOR_MSFTExtendsXrObjectType.- See Also:
-
XR_ERROR_CREATE_SPATIAL_ANCHOR_FAILED_MSFT
public static final int XR_ERROR_CREATE_SPATIAL_ANCHOR_FAILED_MSFTExtendsXrResult.- See Also:
-
-
Method Details
-
nxrCreateSpatialAnchorMSFT
Unsafe version of:CreateSpatialAnchorMSFT -
xrCreateSpatialAnchorMSFT
public static int xrCreateSpatialAnchorMSFT(XrSession session, XrSpatialAnchorCreateInfoMSFT createInfo, org.lwjgl.PointerBuffer anchor) Creates a spatial anchor.C Specification
The
CreateSpatialAnchorMSFTfunction is defined as:XrResult xrCreateSpatialAnchorMSFT( XrSession session, const XrSpatialAnchorCreateInfoMSFT* createInfo, XrSpatialAnchorMSFT* anchor);Description
Creates an
XrSpatialAnchorMSFThandle representing a spatial anchor that will track a fixed location in the physical world over time. That real-world location is specified by the position and orientation of the specifiedXrSpatialAnchorCreateInfoMSFT::posewithinXrSpatialAnchorCreateInfoMSFT::spaceatXrSpatialAnchorCreateInfoMSFT::time.The runtime must avoid long blocking operations such as networking or disk operations for
CreateSpatialAnchorMSFTfunction. The application may safely use this function in UI thread. Though, the created anchor handle may not be ready immediately for certain operations yet. For example, the corresponding anchor space may not return valid location, or its location may not be successfully saved in anchor store.If
XrSpatialAnchorCreateInfoMSFT::spacecannot be located relative to the environment at the moment of the call toCreateSpatialAnchorMSFT, the runtime must returnERROR_CREATE_SPATIAL_ANCHOR_FAILED_MSFT.After the anchor is created, the runtime should then adjust its position and orientation over time relative to other spaces so as to maintain maximum alignment to its original real-world location, even if that changes the anchor’s relationship to the original
XrSpatialAnchorCreateInfoMSFT::spaceused to initialize it.Valid Usage (Implicit)
- The
XR_MSFT_spatial_anchorextension must be enabled prior to callingCreateSpatialAnchorMSFT sessionmust be a validXrSessionhandlecreateInfomust be a pointer to a validXrSpatialAnchorCreateInfoMSFTstructureanchormust be a pointer to anXrSpatialAnchorMSFThandle
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
- Parameters:
session- a handle to anXrSession.createInfo- a pointer to anXrSpatialAnchorCreateInfoMSFTstructure containing information about how to create the anchor.anchor- a pointer to a handle in which the createdXrSpatialAnchorMSFTis returned.
- The
-
nxrCreateSpatialAnchorSpaceMSFT
Unsafe version of:CreateSpatialAnchorSpaceMSFT -
xrCreateSpatialAnchorSpaceMSFT
public static int xrCreateSpatialAnchorSpaceMSFT(XrSession session, XrSpatialAnchorSpaceCreateInfoMSFT createInfo, org.lwjgl.PointerBuffer space) Creates a space from a spatial anchor.C Specification
The
CreateSpatialAnchorSpaceMSFTfunction is defined as:XrResult xrCreateSpatialAnchorSpaceMSFT( XrSession session, const XrSpatialAnchorSpaceCreateInfoMSFT* createInfo, XrSpace* space);Description
Creates an
XrSpacehandle based on a spatial anchor. Application can provide anXrPosefto define the position and orientation of the new space’s origin relative to the anchor’s natural origin.Multiple
XrSpacehandles may exist for a givenXrSpatialAnchorMSFTsimultaneously, up to some limit imposed by the runtime. TheXrSpacehandle must be eventually freed via theDestroySpacefunction or by destroying the parentXrSpatialAnchorMSFThandle.Valid Usage (Implicit)
- The
XR_MSFT_spatial_anchorextension must be enabled prior to callingCreateSpatialAnchorSpaceMSFT sessionmust be a validXrSessionhandlecreateInfomust be a pointer to a validXrSpatialAnchorSpaceCreateInfoMSFTstructurespacemust be a pointer to anXrSpacehandle
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
- Parameters:
session- a handle to anXrSession.createInfo- a pointer to anXrSpatialAnchorSpaceCreateInfoMSFTstructure containing information about how to create the anchor.space- a pointer to a handle in which the createdXrSpaceis returned.
- The
-
xrDestroySpatialAnchorMSFT
Destroys a spatial anchor.C Specification
The
DestroySpatialAnchorMSFTfunction is defined as:XrResult xrDestroySpatialAnchorMSFT( XrSpatialAnchorMSFT anchor);Description
XrSpatialAnchorMSFThandles are destroyed usingDestroySpatialAnchorMSFT. By destroying an anchor, the runtime can stop spending resources used to maintain tracking for that anchor’s origin.Valid Usage (Implicit)
- The
XR_MSFT_spatial_anchorextension must be enabled prior to callingDestroySpatialAnchorMSFT anchormust be a validXrSpatialAnchorMSFThandle
Thread Safety
- Access to
anchor, and any child handles, must be externally synchronized
Return Codes
- On success, this command returns
- On failure, this command returns
See Also
- Parameters:
anchor- a handle to anXrSpatialAnchorMSFTpreviously created byCreateSpatialAnchorMSFT.
- The
-