Instant Tracker
Related documentations |
---|
Tracker Coordinate System in Unity |
Instant Tracker instantly recognizes and tracks gravity-perpendicular planes (e.g., desk planes, floor planes) in camera footage. You can augment content anywhere on the plane.
Make Instant Tracker Scene
Start / Stop Tracker
Use Tracking Information
Hardware Requirements for Android
Make Instant Tracker Scene
[Install MAXST AR SDK for Unity.][Install MAXST AR SDK for Unity]
Create a new scene.
Delete the Main Camera that exists by default and add 'Assets > MaxstAR > Prefabs > ARCamera, InstantTrackable' to the scene.
※ If you build an application, you must add a License Key to ARCamera.
Create an empty object and add 'Assets > MaxstARSamples > Scripts > InstantTrackerSample' as a component.
Create a Button, place it in the proper location, and register the OnClickStart () function of the InstantTrackerSample script in the Click Event.
Drag the Text of the Button to the Start Btn Text of the Instant Tracker Sample script.
After creating a cube as a child of InstantTrakable, adjust the scale between 0.1 and 0.3.
Build and run the app. Then, touch the button on the app screen to instantly recognize the gravity-perpendicular plane visible to the camera and augment the Cube on top of it.
※ When you press the Play button in Unity, your webcam doesn't have a gravity sensor, so it can't recognize a plane perpendicular to gravity.
Start / Stop Tracker
To start / stop Tracker, refer to the following code.
>InstantTrackerSample.cs
void Update() { ... TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_INSTANT); SensorDevice.GetInstance().Start(); ... } void OnApplicationPause(bool pause) { ... SensorDevice.GetInstance().Stop(); TrackerManager.GetInstance().StopTracker(); ... } void OnDestroy() { SensorDevice.GetInstance().Stop(); TrackerManager.GetInstance().StopTracker(); TrackerManager.GetInstance().DestroyTracker(); }
Use Tracking Information
To use the Tracking information, refer to the following code.
>InstantTrackerSample.cs
void Update() { ... TrackingState state = TrackerManager.GetInstance().UpdateTrackingState(); TrackingResult trackingResult = state.GetTrackingResult(); instantTrackable.OnTrackFail(); if (trackingResult.GetCount() == 0) { return; } if (Input.touchCount > 0) { UpdateTouchDelta(Input.GetTouch(0).position); } Trackable trackable = trackingResult.GetTrackable(0); Matrix4x4 poseMatrix = trackable.GetPose() * Matrix4x4.Translate(touchSumPosition); instantTrackable.OnTrackSuccess(trackable.GetId(), trackable.GetName(), poseMatrix); }
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 +