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.
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.
Plane AR Manager
The BP_SpacesARManager_PlaneDetection
blueprint file (located under SnapdragonSpacesSamples 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 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 beEARObjectClassification::NotApplicable
. Please, use theGetObjectClassification
function to make sure.
- In contrast to the other cases, different types of objects can be registered as
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_SessionConfig_ConvexHull
asset (located under SnapdragonSpacesSamples 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