Detect planes in the real world
Now that a basic scene has been set up, you can start on developing the game. In this step, you will detect planes and draw them to the scene.
Add an PlaneDetector
component
An PlaneDetector
detects and creates, updates, and removes game objects when the device's understanding of the environment changes.
-
Using the Hierarchy pane, create an empty
GameObject
. -
Rename it to
PlaneDetector
. This component will display planes until one is selected by the player. -
Select the new game object. Within the Inspector pane, click Add Component to add a
PlaneDetector
-
Configure the
PlaneDetector
by setting theDetected Plane Prefab
field:
- Click the button next to
None
to bring up the Select GameObject window. - Select the Assets tab and search for WoodenPlaneVisualizer.
This prefab from the starter package provides a wooden floor texture that will be used as the plane decoration.
Run the app
-
Build and deploy your app as described in Step 7 and 8 in Getting Started with NRSDK to test your changes
-
Point your glasses at a horizontal real-world surface and move your glasses around to improve NRSDK's understanding of the world.
-
When NRSDK has detected a plane, you should see a wood texture cover real-world surfaces. The
Plane Detector
instantiates the givenDetected Plane Prefab
for each detected plane.