# Plane detection sample

This sample demonstrates how to visualize tracked planes (flat surfaces) found in the real world.

For basic information about plane detection/tracking and what AR Foundation’s `AR Plane Manager` component does, see [Unity documentation](https://docs.unity3d.com/Packages/com.unity.xr.arfoundation&#64;5.1/manual/features/plane-detection/arplanemanager.html). To use this feature, enable it in the OpenXR plugin settings located under `Project Settings > XR Plug-in Management > OpenXR (> Android Tab)`. For more information, see [Plane Detection Feature](https://docs.qualcomm.com/doc/80-88642-12/topic/features_planedetection.html#plane-detection).

## How the plane detection sample works

To use the `Plane Detection` feature, enabled in the OpenXR project settings.

There are two components required in the scene to see the planes while running the experience. Adding the `ARPlaneManager` to the **XR Origin** gameObject enables 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.

When the sample is running, the user can toggle the option to **Use Convex Hull**. When **Use Convex Hull** is enabled, the convex hull of the detected planes is used to generate more complex shapes. When disabled, it generates planes based on the extents of the detected planes instead.

There can be false positives for dynamically moving objects or people. False positives are short-lived because the planes are updated frequently.

Last Published: Oct 23, 2025

[Previous Topic
Spatial meshing sample](https://docs.qualcomm.com/bundle/publicresource/80-88642-12/topics/samples_meshing.md) [Next Topic
QR code tracking sample](https://docs.qualcomm.com/bundle/publicresource/80-88642-12/topics/samples_qrcodetracking.md)