Planes
This page is a supplement to the AR Foundation Plane detection manual. The following sections only contain information about APIs where Meta's OpenXR runtime exhibits unique 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.
Space Setup
Before your app can access planes from Meta's OpenXR runtime, the user must first complete Space Setup on their device.
Unlike other AR platforms, Meta OpenXR does not dynamically discover planes at runtime. Instead, this provider queries the device's Space Setup data and returns all plane components that are stored in its Scene Model. Some entities in the Scene Model, such as Tables or Couches, include planes, while others do not.
Important
If Space Setup is not complete, AR Foundation cannot access plane data from the device. If your app requires planes, you can use scene capture to prompt the user to complete Space Setup.
Permissions
Your app's user must grant an Android system permission before you can access plane data. Refer to Permissions for more information.
Trackable ID
Unlike other AR platforms, the trackableId property of any ARPlane from the Meta OpenXR platform persists across multiple sessions in the same space setup. This allows you to, for instance, save the trackableId
of a user's table to persist a virtual centerpiece on the table each time the user runs your app.
Plane alignment
Also unique to the Meta OpenXR platform is the planeAlignmentThreshold property, which determines the threshold for PlaneAlignment categorization. Plane alignment is calculated by taking each component of the plane's normal vector and finding their difference from 0. If the difference is less than the planeAlignmentThreshold
, then the MetaOpenXRPlaneSubsystem
will categorize the plane depending on which of the normal vector's components are within the threshold. The x
and z
components are both checked for horizontal planes while the y
component is checked for vertical planes.
Plane classifications
This package maps Meta's native semantic label component to AR Foundation's PlaneClassifications. Meta supports multiple classifications per plane.
Refer to the table below to understand the mapping between AR Foundation's classifications and Meta's semantic labels:
AR Foundation Label | Meta Label |
---|---|
Table | TABLE |
Couch | COUCH |
Floor | FLOOR |
Ceiling | CEILING |
WallFace | WALL_FACE |
WallArt | WALL_ART |
DoorFrame | DOOR_FRAME |
WindowFrame | WINDOW_FRAME |
InvisibleWallFace | INVISIBLE_WALL_FACE |
Other | OTHER |
Native pointer
BoundedPlane.nativePtr values returned by this package contain a pointer to the following struct:
typedef struct UnityXRNativePlane
{
int version;
void* planePtr;
} UnityXRNativePlane;
Cast the void* planePtr
to an XrSpace handle in C++ using the following example code:
// Marhshal the native plane data from the BoundedPlane.nativePtr in C#
UnityXRNativePlane nativePlaneData;
XrSpace* planeXrSpaceHandle = reinterpret_cast<XrSpace*>(&nativePlaneData.planePtr);
To learn more about native pointers and their usage, refer to Extending AR Foundation.