Every project built with the Zappar for Unity package must contain a Zappar camera. The Zappar camera is a modified Unity camera perfected for AR.
Adding a Zappar Camera
To get started with AR development in Unity, add a Zappar Camera from the Zappar menu.
The resulting object is a regular Unity camera object that makes the following changes:
- Its camera parameters (e.g. focal length) will be set automatically by the Zappar library to match those of the physical camera on your device
- The physical camera feed will be drawn as a background to your scene
- By default, the position of the camera is the origin of your scene, pointing down the Z axis. Objects that you track, e.g. the user's face, will move around in your scene so they appear in the correct location to the (stationary) camera.
Please remove any other cameras you have (Main Camera), or mark the Zappar Camera as your primary/active camera.
Modifying the Zappar Camera
The camera object has a few properties you may like to change:
|Anchor Origin||if this is set to an instance of one of the tracking objects, that instance will become the origin of your scene. In this mode, the camera will move around that instance in 3D space (instead of remaining at the origin).|
|Use Front-Facing Camera||this causes the Zappar library to display the 'selfie' camera to the user (rather than the rear-facing camera) - useful for face filter experiences.|
|Camera Attitude From Gyro||with this selected, the camera will remain at the origin of your scene, but rotate according to the device's orientation in 3D space. This means that your scene will remain flat with respect to gravity. This mode is useful if you have lighting effects or physics that require your scene to be aligned with the user's real-world environment.|
|Mirror Cameras||these options can be used to automatically mirror the camera background and 3D content. Users expect the content/image of user-facing cameras to be mirrored.|
|EditorCamera||select the camera to use when testing in PlayMode.|
Once a Zappar camera is in your Hierarchy, the next step is to add a tracking object.
Next Article: Tracking Objects