The Zappar library provides multiple modes for the camera to move around in your Unity scene. You can change this behavior by calling one of the relevant camera pose functions:
||in this mode the camera stays at the origin of the scene, pointing down the positive Z axis. Any tracked anchors will move around in your scene as the user moves the physical camera and real-world tracked objects.|
||the camera stays at the origin of the scene, but rotates as the user rotates the physical device. When the Zappar library initializes, the positive Z axis of world space points forward in front of the user.|
||the origin of the scene is the center of the anchor specified by the parameter passed to this function. In this case the camera moves and rotates in world space around the anchor at the origin.|
The correct choice of camera pose will depend on your given use case and content. Here are some examples you might like to consider when choosing which is best for you:
To have a light that always shines down from above the user, regardless of the angle of the device or anchors, use
Z.CameraPoseModeWithAttitude(...)and place a light shining down the negative Y axis of world space.
In an application with a physics simulation of stacked blocks, and with gravity pointing down the negative Y axis of world space, using
Z.CameraPoseWithOrigin(...)would allow the blocks to rest on a tracked image regardless of how the image is held by the user, while using
Z.CameraPoseWithAttitude(...)would allow the user to tip the blocks off the image by tilting it.
If you're using our supplied
ZapparCamera component, you can access the pose of a
ZapparCamera in the scene by calling:
Matrix4x4 cameraPose = ZapparCamera.Instance.GetPose();
from any script. Set the
cameraAttitude parameter of
true if you wish for the camera pose to be driven by device attitude. Similarly, attach a
ZapparTrackingTarget object to the
ZapparCamera.anchorOrigin property in the inspector if you wish for the camera pose to be driven by a tracked target.
Note that you do not have to use the provided implementation of
ZapparCameraand the various tracking types in your own application. They are simply example scripts that provide fully working implementations for working with the basic functionality of the Zappar API.