Instant Tracker
Related documentations |
---|
Tracker Coordinate System in Unity |
1. Definition
2. Video See-Through
2.1. Make Instant Tracker Scene
2.2. Start / Stop Tracker
2.3. Use Tracking Information
3. Optical See-Through
4. GitHub Unity Scene Example
5. Hardware Requirements for Android
1. Definition
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.
2. Video See-Through
2.1. 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.
After Playing, click the button to learn the space instantly and augment the cube.
Connect the smart glasses to the PC to build, Select ARCamera > Configuration > Wearable Type to None and build.
2.2. 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(); }
2.3. 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); }
3. Optical See-Through
Connect the smart glasses to the PC to build, Select ARCamera > Configuration > Wearable Type to Optical See Through and build.
4. GitHub Unity Scene Example
GitHub Unity Scene Example: https://github.com/maxstdev/MaxstARSDK_Unity_Sample.git
- ExtraInstantTrackerBrush
- ExtraInstantTrackerGrid
- ExtraInstantTrackerMultiContents
5. 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 +