# 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.

# 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. Adding the 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.

Plane Visualization