C++ Java Unity
Java Reference
PositionalDeviceTracker Class Reference

Detailed Description

A type of DeviceTracker that tracks the world-relative position and rotation of the device.

The PositionalDeviceTracker tracks the device in the world based on the environment.

While this Tracker is running, the device's position and rotation are made available on the State class as a DeviceTrackableResult containing a 6DOF pose, specified in meters in the world coordinate system. The origin of the world coordinate system corresponds to the position and orientation of the device when tracking starts.

PositionalDeviceTracker also provides extended tracking functionality. As long as the PositionalDeviceTracker is running, previously detected Trackables will continue to report poses via the State class, even if they are no longer visible in the device's camera.

This assumes that the Trackable remains static relative to the user's environment. If the Trackable is moved while it is out of view of the camera, its pose will snap to its new location once it comes back into view of the camera and Vuforia re-detects it. For some Trackables, the detection distance may be closer than the tracking distance. You may need to move the camera closer than expected to the Trackable so that it updates its pose after it has moved.

You can use TrackableResult::getStatus() to determine whether a Trackable is being tracked directly or using extended tracking.

The PositionalDeviceTracker may need some extra manual initialization steps on some devices, depending on the active Fusion provider (as returned by Vuforia::getActiveFusionProvider()).

Inheritance diagram for PositionalDeviceTracker:
DeviceTracker Tracker

Public Member Functions

boolean equals (Object obj)
 
Anchor createAnchor (String name, Matrix34F pose)
 Create a named Anchor with a particular world position and rotation. More...
 
Anchor createAnchor (String name, HitTestResult hitTestResult)
 Create a named Anchor using the result of a hit test from a SmartTerrain. More...
 
boolean destroyAnchor (Anchor anchor)
 Destroy the given Anchor. More...
 
AnchorList getAnchors ()
 Get the list of anchors. More...
 
boolean reset ()
 Reset the tracker. More...
 
- Public Member Functions inherited from DeviceTracker
boolean equals (Object obj)
 
- 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 'PositionalDeviceTracker'. More...
 
- Static Public Member Functions inherited from DeviceTracker
static Type getClassType ()
 Get the Type for class 'DeviceTracker'. 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 'PositionalDeviceTracker'.

Anchor createAnchor ( String  name,
Matrix34F  pose 
)

Create a named Anchor with a particular world position and rotation.

This method creates an Anchor at an arbitrary position and orientation in the world.

Depending on the active Fusion provider (see Vuforia::getActiveFusionProvider()), tracking of Anchors created with this method may be poor under certain conditions. For this reason, it is recommended that you only create Anchors using createAnchor(const char*, const HitTestResult&), rather than using this method. If you want to render something at an arbitrary position in the world, for example floating in the air, create a hit-test-based Anchor and then apply an offset transform in your application logic.

For platform-independent behavior, you should always create the first anchor from a HitTestResult.

To destroy an Anchor, call destroyAnchor(). Do not delete the pointer yourself. A call to reset() invalidates (destroys) all Anchors. Do not access the returned pointer after calling reset().

Note: Creating anchors is not supported if the active Fusion provider is FUSION_PROVIDER_VUFORIA_VISION_ONLY (see Vuforia::getActiveFusionProvider()).

Note: If the active Fusion provider is FUSION_PROVIDER_VUFORIA_SENSOR_FUSION, extra steps are required to fully initialize the PositionalDeviceTracker before using this method. See the Initialization section in the class documentation above for more details.

Note: When using FUSION_PROVIDER_VUFORIA_SENSOR_FUSION, reported Anchor poses may fluctuate at first, until Vuforia has learned enough about the environment to provide a stable pose estimate. This typically takes a few seconds after creating the first Anchor from a HitTestResult, depending on how the user moves their device.

Note: When using FUSION_PROVIDER_VUFORIA_SENSOR_FUSION, Anchors created with this method are not guaranteed to receive any further position updates after the device tracker recovers from a limited tracking state.

Parameters
nameThe name for the new anchor.
poseThe pose (position and orientation) for the anchor.
Returns
The newly created anchor, or NULL on failure (check application log for details).
Anchor createAnchor ( String  name,
HitTestResult  hitTestResult 
)

Create a named Anchor using the result of a hit test from a SmartTerrain.

This method is the preferred way to attach augmentations to arbitrary points in the user's environment. If you need the augmentation to appear somewhere other than the surface of the plane detected by the hit test, apply an offset transform in your application logic.

To destroy an Anchor, call destroyAnchor(). Do not delete the pointer yourself. A call to reset() invalidates (destroys) all Anchors. Do not access the returned pointer after calling reset().

Note: When using FUSION_PROVIDER_VUFORIA_SENSOR_FUSION, reported Anchor poses may fluctuate initially until Vuforia has learned enough about the environment to provide a stable pose estimate (typically until a few seconds after creating the first Anchor from a HitTestResult, depending on how the user moves their device).

Parameters
nameThe name for the new Anchor.
hitTestResulta HitTestResult as returned from SmartTerrain::hitTest(). The HitTestResult must not have been already used to create an Anchor.
Returns
The newly created Anchor, or NULL on failure (check application log for details).
boolean destroyAnchor ( Anchor  anchor)

Destroy the given Anchor.

Deletes the given Anchor and cleans up all associated internal resources.

Do not access the pointer after calling this method.

Returns
true if destroyed successfully, false if the Anchor is invalid (e.g. null).
AnchorList getAnchors ( )

Get the list of anchors.

boolean reset ( )

Reset the tracker.

Calling this function invalidates (destroys) all Anchors. Do not hold on to any existing Anchor pointers after calling this function.

Note: On some platforms a new world origin will be defined at the device's current position and orientation.

Note: On some platforms the underlying Vuforia Fusion provider may also be reset.

Returns
true if the tracker was successfully reset, otherwise false (check application logs for failure details).