Anchors
This page is a supplement to the AR Foundation Anchors manual. The following sections describe the optional features of AR Foundation's XRAnchorSubsystem supported by ARCore.
Tip
When developing an AR app, refer to both the AR Foundation documentation as well as the required packages for each platform you support.
Optional feature support
ARCore implements the following optional features of AR Foundation's XRAnchorSubsystem:
Feature | Descriptor Property | Supported |
---|---|---|
Trackable attachments | supportsTrackableAttachments | Yes |
Synchronous add | supportsSynchronousAdd | Yes |
Save anchor | supportsSaveAnchor | |
Load anchor | supportsLoadAnchor | |
Erase anchor | supportsEraseAnchor | |
Get saved anchor IDs | supportsGetSavedAnchorIds | |
Async cancellation | supportsAsyncCancellation |
Note
Refer to AR Foundation Anchors platform support for more information on the optional features of the anchor subsystem.
Native pointer
XRAnchor.nativePtr values returned by this package contain a pointer to the following struct:
typedef struct UnityXRNativeAnchor
{
int version;
void* anchorPtr;
} UnityXRNativeAnchor;
This package also provides a header file containing the definitions of various native data structs including UnityXRNativeAnchor
. It can be found in the package directory under Includes~/UnityXRNativePtrs.h
.
Cast void* anchorPtr
to an ArAnchor handle in C++ using the following example code:
// Marhshal the native anchor data from the XRAnchor.nativePtr in C#
UnityXRNativeAnchor nativeAnchorData;
ArAnchor* anchorHandle = static_cast<ArAnchor*>(nativeAnchorData.anchorPtr);
To learn more about native pointers and their usage, refer to Extending AR Foundation.