# Plane Detection Sample

This sample demonstrates how to visualize tracked planes found in the real world. For basic information about custom trackable object updates and what Unreal Engine's AR Trackable Notify component does, please refer to the Unreal Engine documentation (opens new window). In order to use this feature there are two options, Plane Detection or Spatial Meshing, which will have different results in terms of shape and number of planes. One of them has to be enabled in the OpenXR plugin settings located under Project Settings > Snapdragon Spaces plugin. If both are enabled, Plane Detection will have priority and will be used as the plane detection source, if Plane Detection is not enabled Spatial Meshing will be used as the plane detection source.

# How the sample works

By default, when the sample is opened, it generates simple shapes for the detected planes. When the Use Convex Hull detection option is enabled, the sample generates complex shapes using the convex hull of the detected planes.

It's also possible to display the wireframe of these geometries.

Planes Detection UI

# Plane AR Manager

The BP_PlaneARManager blueprint file (located under Content > SnapdragonSpaces > Samples > PlaneDetection > Placeable) centralizes the actions of creating and destroying planes as augmented geometries through an event system. This blueprint binds events from the AR Trackable Notify component (opens new window) to react to AR trackable planes changes. The following events are related to plane detection:

  • On Add/Update/Remove Tracked Plane: These events are called when the system is using simple plane geometry.
  • On Add/Update/Remove Tracked Geometry: These events are called when the system is using complex plane geometry.
    • In contrast to the other cases, different types of objects can be registered as UARTrackedGeometry. To verify that it is a convex plane, its object classification should be EARObjectClassification::NotApplicable. Please, use the GetObjectClassification function to make sure. Object classification for convex planes


Remember to change the state of ToggleARCapture to restart the detection, selecting ON when the actor behavior begins, and stop the detection, selecting OFF when finished, to destroy all generated AR geometries.

# Complex AR Session Config

When the user enables the convex option, the system starts using the D_ConvexHullSessionConfig asset (located under Content > SnapdragonSpaces > Samples > PlaneDetection > Core) to detect the complex planes.

The options related to plane detection are:

  • Use Convex Hull Detection
  • Horizontal Plane Detection
  • Vertical Plane Detection