Try MAXST AR Fusion Tracker Now ✨

Instant Tracker

Related documentations
Tracker Coordinate System

The Instant Tracker instantly scans the planar surface in the camera frame and recognizes the space with sensors. You can find the rendered 3D object on the space.

Start / Stop Tracker
Use Tracking Information
Create Instant Target Data
Hardware Requirements for Android

Start / Stop Tracker

To start / stop Tracker, refer to the following code.

>InstantTrackerActivity.java

@Override
protected void onResume() {
    ...
   TrackerManager.getInstance().startTracker(TrackerManager.TRACKER_TYPE_INSTANT);
    ...
}

@Override
protected void onPause() {
    ...
    TrackerManager.getInstance().stopTracker();
    ...
}

Use Tracking Information

To augment an object using Tracking results, refer to the following code.

>InstantTrackerRenderer.java

public void onDrawFrame(GL10 unused) {
    ...
    
    TrackingState state = TrackerManager.GetInstance().UpdateTrackingState();
    TrackingResult trackingResult = state.GetTrackingResult(); 
    ...
    
    if (trackingResult.getCount() == 0) {
        return;
    }
    ...
    
    Trackable trackable = trackingResult.getTrackable(0);
    
    GLES20.glEnable(GLES20.GL_DEPTH_TEST);
    
    texturedCube.setTransform(trackable.getPoseMatrix());
    texturedCube.setTranslate(posX, posY, -0.05f);
    texturedCube.setProjectionMatrix(projectionMatrix);
    texturedCube.draw();
}

Create Instant Target Data

You can create new data only when it is not in Tracking state. Refer to the following code.

>InstantTrackerActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.start_tracking:
            String text = startTrackingButton.getText().toString();
            if (text.equals(getResources().getString(R.string.start_tracking))) {
                TrackerManager.getInstance().findSurface();
                instantImageTargetRenderer.resetPosition();
                startTrackingButton.setText(getResources().getString(R.string.stop_tracking));
            } else {
                TrackerManager.getInstance().quitFindingSurface();
                startTrackingButton.setText(getResources().getString(R.string.start_tracking));
            }
            break;
    }
}

Hardware Requirements for Android

MAXST AR SDK's Instant Tracker uses internally Android Rotation Vector related to both gyro and compass sensors.

If your target device has no gyro or compass sensor, the engine can not find the initial pose. If there is no sensor value, our engine assumes the front scene as a ground plane.

If you want to check whether the current device support Android Rotation Vector, please refer to the following codes.

 
SensorManager mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
List<Sensor> sensors = mSensorManager.getSensorList(TYPE_ROTATION_VECTOR);
Log.i(TAG, "# sensor : " + sensors.size());
for(int i=0; i<sensors.size(); i++)
{
   Log.i(TAG, sensors.get(i).getName());
}
if(sensors.isEmpty())
{
   Log.i(TAG,"There is no Rotaion Vector");
}

Devices that do not support the Android Rotation Vector

Samsung Galaxy J5, Moto G5 Plus, Moto G4 Plus, Iball Andi 5U, Geonee S +