Skip to content

Zappar Camera

Before setting up Augmented Reality tracking, you must first add (or replace any existing camera you have in your .zcomp with) a ZapparCamera component to your Hierarchy.

To add a ZapparCamera component to an existing project, you will first need to install the Augmented Reality by Zappar package from the dependencies browser if you have not already.

Installing the Augmented Reality by Zappar package

To start using the `ZapparCamera` from here, you can then add the `ZapparCamera` component to your **Hierarchy** by using the following instructions:
  1. Click on the + (plus) icon in your Hierarchy (or right click on a Group Node)
  2. Find the AR component category and from here, select ZapparCamera

The ZapparCamera will give you the correct parameters to track content, as well as request the appropriate permissions to access the camera and motion sensors on the user’s device.

The ZapparCamera component has the following specific properties:

PropertyDescription
Pose ModeDescribes how the camera moves around in the three.js scene. See more below.
Origin AnchorThe camera will move and rotate in world space around the anchor at the specified origin (component in the Hierarchy).
Rear Mirror ModeDescribes whether your camera (Poses) or entire canvas (CSS) is mirrored or not (None) when using the rear facing camera.
User Mirror ModeDescribes whether your camera (Poses) or entire canvas (CSS) is mirrored or not (None) when using the user facing camera.
Camera DirectionChoose whether the camera is rear or user facing.
FarAlter the far clipping plane.
NearAlter the near clipping plane.

Mattercraft provides multiple modes for the camera to move around in the three.js scene.

Pose ModeDescription
DefaultThe camera will stay at the origin of the scene, pointing down the negative Z axis. Any tracked anchors will move around in your scene as the user moves the physical camera and real-world tracked objects.
AttitudeThe camera will stay at the origin of the scene, but rotates as the user rotates the physical device. When the experience initializes, the negative Z axis of world space points forward in front of the user.
AnchorOriginThe origin of the scene is the center of the anchor specified by the camera’s Origin Anchor parameter. 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 the Attitude pose mode and place a light shining down the negative Y axis is 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 the AnchorOrigin pose mode would allow the blocks to rest on a tracked image regardless of how the image is held by the user.
  • In a similar application, the Attitude pose mode would allow the user to tip the blocks off the image by tilting it.

With a ZapparCamera inside your .zcomp, you can then start using the following Augmented Reality tracking types: