In Augmented Reality (AR), plane detection refers to the process of recognizing flat, horizontal/vertical surfaces in the real-world environment using
Plane detection is considered a fundamental feature in AR applications as it allows virtual objects to be placed and interact with the real world more realistically. By detecting the planes in the environment, AR applications can position virtual content, ensuring it appears anchored to the detected surfaces. Open Unity Hub and create an AR project.
The AR plane manager is a component in Unity's AR foundation framework that helps you work with and manage detected surfaces, commonly referred to as "planes," in an AR environment. AR plane manager has:
This refers to a GameObject that represents the visual representation of the detected planes in the AR scene. When the Plane Manager detects a flat, horizontal surface, it instantiates this prefab to display a visual representation of the detected plane in the AR environment. The prefab typically includes a visual mesh or some visual indicators to indicate the position and size of the detected plane.
This is a setting in the plane manager that determines how the AR system detects and updates the detected planes in the environment. There are typically two main detection modes:
Horizontal plane detection: In this mode, the AR system focuses on detecting and tracking flat, horizontal surfaces like floors and tables. It ignores other surfaces that are not horizontally oriented.
Vertical plane detection: In this mode, the AR system detects and tracks vertical surfaces like walls. This is useful for placing virtual objects on walls or aligning AR content with vertical features in the environment.
Everything: This mode detects and tracks both vertical and horizontal surfaces.
In XR origin, add the AR plane manager as a component. Choose the detection mode that best suits your requirements.
For the plane prefab we will be using a default plane. To add an AR default plane go to add > XR > AR default plane.
Leave the default setting for the default plane. Create a prefabs folder and drag the AR default plane there. From there, drag the AR default plane prefab into the plane prefab.
Save the scene. Connect your Android or iOS device. Go to File > Build and Run.
By configuring the plane manager's plane prefab and detection mode, you can create AR experiences that effectively leverage the detected planes in the real-world environment.
Free Resources