C++ Java Unity
C++ Reference
SmartTerrain Class Referenceabstract

Detailed Description

A type of Tracker that collects information about the user's environment at runtime.

You can use the information collected to make hit tests into the user's environment.

The functionality and operation of SmartTerrain is affected by the active Fusion provider (see Vuforia::getActiveFusionProvider()).

  • SmartTerrain cannot be used with FUSION_PROVIDER_VUFORIA_VISION_ONLY, and will therefore fail to start.
  • When using FUSION_PROVIDER_VUFORIA_SENSOR_FUSION, no hit test results will be returned until the PositionalDeviceTracker has been initialized. This requires some motion and may take a few seconds, depending on how the user moves their device. See PositionalDeviceTracker for more details.
  • When using FUSION_PROVIDER_PLATFORM_SENSOR_FUSION, no hit test results will be returned until the underlying platform systems have initialized. This typically takes a few seconds, depending on how the user moves their device.

For cross-platform consistency, you should assume that

  • calls to hitTest() might not yield any results for a few seconds, and
  • the reported position of an Anchor created from early hit test results may fluctuate for a few seconds as Vuforia learns more about the environment.
Inheritance diagram for SmartTerrain:
Tracker NonCopyable

Public Types


Public Member Functions

virtual List< const HitTestResulthitTest (Vec2F point, HITTEST_HINT hint, State state, float deviceHeight)=0
 Performs hit test. More...
- Public Member Functions inherited from Tracker
virtual Type getType () const =0
 Get the Type of this instance (may be a subclass of Tracker). More...
virtual bool isOfType (Type type) const =0
 Get whether this Tracker instance's type equals or has been derived from the given type. More...
virtual bool start ()=0
 Start the Tracker. More...
virtual void stop ()=0
 Stop the Tracker. More...
virtual ~Tracker ()

Static Public Member Functions

static Type getClassType ()
 Get the Type for class 'SmartTerrain'. More...
- Static Public Member Functions inherited from Tracker
static Type getClassType ()
 Get the Type for class 'Tracker'. More...

Member Enumeration Documentation


no hint


hit test is performed on a horizontal plane


hit test is performed on a vertical plane (not supported yet)

Member Function Documentation

static Type getClassType ( )

Get the Type for class 'SmartTerrain'.

virtual List<const HitTestResult> hitTest ( Vec2F  point,
State  state,
float  deviceHeight 
pure virtual

Performs hit test.

This function will perform a hit test between a ray and a plane in the world as understood by the SmartTerrain. The ray is cast from the given point on the device's screen (typically from a user tapping the screen). An approximate deviceHeight above an assumed infinite ground plane may be used to provide an estimated ground plane intersection when the available data on the environment is limited. A single hit test may generate multiple results if the ray intersects more than one detected plane.

Specific behaviour of the hit test depends on the active Fusion provider (see Vuforia::getActiveFusionProvider())).

  • When using FUSION_PROVIDER_VUFORIA_SENSOR_FUSION, deviceHeight specifies the device's approximate height above an assumed infinite ground plane on which the hit test result may lie; however it will be ignored if an existing (finite, localized) plane from a previous hit test is found along or near to the ray path. Additionally, Vuforia will not return hit test results when the PositionalDeviceTracker is initializing, as indicated by its Trackable status.
  • When using FUSION_PROVIDER_PLATFORM_SENSOR_FUSION, deviceHeight is ignored and Vuforia will only return results when the hit test ray intersects actual detected planes in the user's environment.
A hit test is bound to a specific State. If you want the results to correspond to the current video frame, be sure to use the same State as you use for rendering the frame.
stateThe state to use for doing the hit test.
pointPoint in the normalized coordinate space of the camera image retrieved from the State (top left (0,0), bottom right (1,1)) to use as the origin of the ray.
deviceHeightHeight of the device center above ground plane in meters. May be ignored.
hintA hint about the orientation of the plane in the scene. May be ignored.
A list of hit test results produced by the last hit test. Any subsequent calls to hitTest() will invalidate the content of this list. Returns an empty list if it was not possible to perform the hit test.