Demonstrate how to use surface tracking and image tracking together.

How to Use

Mark 1: Display system status and operation hint.
Mark 2: Switch world center mode.
Mark 3: Start/Stop tracking.

Move the cube on the surface with on finger. Two finger pinch will scale the cube and two finger horizontal move will rotate the cube.

How It Works

Use surface tracking and image tracking together

To use surface tracking and image tracking together, just put them under the same ARSession, and use VIOCameraDevice instead of VideoCameraDevice.


Objects under world root

WorldRoot is designed to do these things,

  • Control show/hide of objects when tracking status change.

  • Move together against camera according to ARSession.CenterMode.

You can ignore WorldRoot If you can make sure all above is handled by yourself.

In this sample, WorldRootController.ActiveControl is set to ActiveControlStrategy.HideWhenNotTracking, so the cube will hide when tracking fails.


Tracking of/off

Surface tracking can be turned on or off using SurfaceTrackerFrameFilter.enabled. You can turn the tracking off when it is not used to save performance, it will not turn off the camera or any other tracking features.

../../_images/image_s12_3.png ../../_images/image_s12_4.png

Center mode

Two mode of ARSession.CenterMode are valid in world sensing.

In ARSession.ARCenterMode.WorldRoot the camera will move automatically when the device moves, and the WorldRoot stay. In ARSession.ARCenterMode.Camera, the camera do not automatically move when the device moves. It is suggested to use ARSession.ARCenterMode.WorldRoot in most cases.

But when a target is tracked, ARSession.ARCenterMode.FirstTarget or ARSession.ARCenterMode.SpecificTarget can also be used, the camera and the WorldRoot will both move in this case.