Anchors
This page is a supplement to the AR Foundation Anchors manual. The following sections only contain information about APIs where Meta Quest exhibits unique platform-specific behavior.
Tip
When developing an AR app, refer to both the AR Foundation documentation as well as the required packages for each platform you support.
Trackable ID
Unlike some other AR platforms, Meta's OpenXR runtime only supports creating anchors asynchronously. To fulfill AR Foundation's synchronous API design for TryAddAnchor, this package generates monotonically increasing TrackableId
s for anchors.
Native pointer
XRAnchor.nativePtr values returned by this package contain a pointer to the following struct:
typedef struct UnityXRNativeAnchor
{
int version;
void* referencePointPtr;
} UnityXRNativeAnchor;
Cast the void* referencePointPtr
to an XrSpace handle in C++ using the following example code:
// Marhshal the native anchor data from the XRAnchor.nativePtr in C#
UnityXRNativeAnchor nativeAnchor;
XrSpace* anchorXrSpaceHandle = static_cast<XrSpace*>(nativeAnchor.referencePointPtr);
To learn more about native pointers and their usage, refer to Extending AR Foundation.