ArbiTrack Basics Android

From Kudan AR Engine
Jump to: navigation, search

This tutorial will go through the basics of using Kudan’s ArbiTrack feature. This will lead on from our previous tutorial which described how to add content to a marker. If you have not already set up a project where you place content onto a marker, we suggest you check it out before going any further.

For this sample we have used:

  • Model : ben.armodel / ben.jet
  • Model Texture : bigBenTexture.png
  • Target Node : target.png

Which can all be downloaded here.

Initialise ArbiTrack and the Gyro Placement Manager

ArbiTrack and the Gyro Placement Manager will need to be initialised before they can be used. As they are singletons they can be called using getInstance from anywhere in the program. The Gyro Placement Manager uses your device’s gyro to position a node and ArbiTrack locks your model in place instantly, by keeping track of arbitrary feature points.

Note: ArbiTrack relies on having a large number of feature points in the environment to track correctly. If you are in a low feature environment, this can cause tracking to become less consistent.

// Initialise ArbiTrack
ARArbiTrack arArbiTrack = ARArbiTrack.getInstance();
// Initialise gyro placement. Gyro placement positions content on a virtual floor plane where the device is aiming.
ARGyroPlaceManager gyroPlaceManager = ARGyroPlaceManager.getInstance();

Create Target Node

To position your model you will need to use a target node. As the target node’s position is altered by the Gyro Placement Manager, it is useful to have a graphical representation of where the target node is. Anything can be used as a target, even the model itself, since the target is itself an ARNode. We will be using a red rectangle image for our target.

// Add a visual reticule to the target node for the user.
targetImageNode = new ARImageNode("target.png");
// Scale and rotate the image to the correct transformation.
targetImageNode.rotateByDegrees(90, 1, 0, 0);
// Set the ArbiTracker target node to the node moved by the user.

Start ArbiTrack

Starting ArbiTrack will lock your model in place. You may also wish to hide your target node as it will not reposition your model until ArbiTrack has been stopped.

//Start ArbiTrack
//Hide target node
//Change enum and label to reflect ArbiTrack state

Stopping ArbiTrack

You may wish to reposition your model in order to do this you will need to stop ArbiTrack and reveal your target node. You can restart ArbiTrack after this and your model will be locked to new possition of the target node.

// Stop ArbiTrack
// Display target node
//Change enum and label to reflect ArbiTrack state