C++ Java Unity
Java Reference
SmartTerrain Class Reference

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

Classes

class  HITTEST_HINT
 

Public Member Functions

boolean equals (Object obj)
 
HitTestResultList hitTest (Vec2F point, int hint, State state, float deviceHeight)
 Performs hit test. More...
 
- Public Member Functions inherited from Tracker
boolean equals (Object obj)
 
Type getType ()
 Get the Type of this instance (may be a subclass of Tracker). More...
 
boolean isOfType (Type type)
 Get whether this Tracker instance's type equals or has been derived from the given type. More...
 
boolean start ()
 Start the Tracker. More...
 
void stop ()
 Stop the Tracker. More...
 

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 Function Documentation

boolean equals ( Object  obj)
static Type getClassType ( )
static

Get the Type for class 'SmartTerrain'.

HitTestResultList hitTest ( Vec2F  point,
int  hint,
State  state,
float  deviceHeight 
)

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.

Note: 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.

Parameters
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.
Returns
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.