Ground Plane API Overview

The Ground Plane is tracking the environment by using HitTest to detect surfaces that are then tracked by the SmartTerrain tracker. The Vuforia SmartTerrain API is used in conjunction with Device Tracking and the PositionalDeviceTracker.

Class Definitions

Main classes

  • SmartTerrain – is responsible for finding and tracking Surfaces and executing hit tests in the World Coordinate Space.
  • PositionalDeviceTracker - maintains position and orientation in world space for the device and Anchors.
  • Anchor - a 6 DoF trackable point in space that is tracked by the PositionalDeviceTracker. Anchor points are persistent locations in the world space that are continually tracked as the world space grows and changes in a Ground Plane session. 

TIP: Use an Anchor when you want your content to be positioned as accurately as possible at a specific location in the world. Use the tracking status to create continuous AR experiences. See Interpreting Tracking State API Results for more information.

SmartTerrain

SmartTerrain is used to collect information about the environment. The information can be used to identify surfaces with the hitTest functions. SmartTerrain can only run successfully in conjunction with Vuforia Fusion and after the initialization of the PositionalDeviceTracker. 

HitTest

HitTest is performed to identify suitable surfaces. It sends a ray to a plane and calculates the relative deviceHeight to a plane. The HitTest behavior depends on the active Fusion Provider given by Vuforia::getActiveFusionProvider(). See also the Ground Plane page for more information on the different hit test UX modes. 

hitTest (Vec2F point, HITTEST_HINT hint, State state, float deviceHeight)

The HitTest cannot be performed before or during initialization of the PositionalDeviceTracker. 

NOTE: Hit testing should use the same State as the frame rendering for the hitTestResults to be accurate. 

PositionalDeviceTracker

Please refer to Using the Device Tracker in Native for an introduction to the PositionalDeviceTracker

The PositionalDeviceTracker delivers the Anchors used to position content in the environment. 

Its initialization steps depend on the Vuforia Fusion Provide you are using. 

Anchors

An Anchor is a trackable representing a point in space with fixed position and orientation. An Anchor is used to position virtual content in the physical space. The Anchor is controlled and managed by the PositionalDeviceTracker.

Create an anchor using

createAnchor (const char *name, const HitTestResult &hitTestResult)

Destroy anchors

destroyAnchor (Anchor * anchor)   

NOTE: Calling reset() invalidates all created Anchors.

App Workflow

The high-level control flow of a Ground Plane App consists of the following steps:

  1. Initialize Vuforia Engine AR
  2. Start the AR Session
  3. Initialize and configure the Trackers required for Ground Plane (PositionalDeviceTracker and SmartTerrain)
  4. Create an Anchor in real-world space (either based on hit test or relative to camera)
  5. Place your content in the anchor
  6. For Every Frame:
    1. Adjust the rendering camera position based on the DeviceTrackable Pose
    2. Adjust the transform of the content based on an updated Anchor position
  7. Use the DeviceTracker states to recover from interrupted sessions. See Best Practices for Continued AR Experiences for more information.
  8. Deinitialize the Trackers (PositionalDeviceTracker and SmartTerrain)
  9. Deinitialize Vuforia Engine AR
  10. For more details on the control flow of a Ground Plane app, please refer to the Ground Plane Native User Guide.

Learn More

Ground Plane Native User Guide

Vuforia Fusion

Device Tracking

Introduction to Ground Plane in Unity