# Plane Detection Sample
This sample demonstrates how to visualize tracked planes found in the real world.
For basic information about plane detection/tracking and what AR Foundation's
AR Plane Manager component does, please refer to the Unity documentation (opens new window).
In order to use this feature it has to be enabled in the OpenXR plugin settings located under
Project Settings > XR Plug-in Management > OpenXR (> Android Tab).
# How the sample works
First and foremost, make sure to have the
Plane Detection feature enabled in the OpenXR project settings.
There are just two components needed in the scene to see planes when running the experience.
ARPlaneManager to the
ARSession gameObject will enable the Plane Subsystem included in the Snapdragon Spaces package. The component provides a field for defining a prefab to spawn upon creating a plane. This prefab has the
AR Plane and
AR Plane Mesh Visualizer attached to it, next to
Mesh Renderer and
Line Renderer. The mesh and the lines are adjusted by the
AR Plane Mesh Visualizer periodically and result in a plane drawn with a fill and border that can be adjusted by altering the materials and properties of the renderers. Furthermore, a
Mesh Collider component can be added to the prefab to receive ray cast hits.
# Feature Settings
Feature settings can be found by clicking the gear icon next to
Plane Detection feature in the OpenXR project settings.
- Use Scene Understanding Plane Detection:
- Enabling or disabling this setting will have different results in terms of the shape and number of planes detected.
- Enabling this setting will enable the use of
Scene Understandingto detect planes. This makes use of the same technology used by the
Spatial Meshing (Experimental)feature.
- While Use Scene Understanding Plane Detection is enabled, when the sample is running the user can toggle the option to Use Convex Hull.
- When Use Scene Understanding Plane Detection is disabled, Use Convex Hull is enabled by default and cannot be unchecked by the user when the sample is running.
- When Use Convex Hull is enabled, the convex hull of the detected planes is used to generate more complex shapes. When disabled, it will generate planes based on the extents of the detected planes instead.
- If scene understanding cannot be loaded for any reason, this feature will act as if Use Scene Understanding Plane Detection is disabled.
Differences Between Default and Scene Understanding-based Plane Detection
|Detection Speed and First Detection
|Few false positives
|Prone to false positives
|Number of Planes
|Plane Updates and Movement
|Stable with unlikely updates
|Dynamic with more plane updates
|Plane Orientation Filter
|Filter options for horizontal and vertical
|No filter options
|As expected against plane
|Hit test against mesh