Demonstrate how to use motion tracking and image tracking together.
How to Use¶
Cube in the scene can be moved in the scene with one finger. Two finger pinch will scale the cube, two finger vertical move will move the cube near/far and two finger horizontal move will rotate the cube.
How It Works¶
Use motion tracking and image tracking together¶
To use motion 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.
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.