Variants and camera
Open the model in one of its colours, and set where the 3D viewer's camera starts and how far it turns.
Variant
A model in the Core AR dashboard can have several variants, such as colours or finishes. Without variant-id the button opens the first one. To open another, copy its id in the Model library with Copy variant ID and set it:
<vizbl-core
api-key="pk_live_YOUR_PUBLISHABLE_KEY"
type="ar-viewer"
object-id="YOUR_OBJECT_ID"
variant-id="YOUR_VARIANT_ID"
></vizbl-core>Every mode opens the variant: the 3D viewer, AR on a phone and the QR code on a computer. An id the model does not have makes the button fail with VARIANT_NOT_FOUND.
Follow the shopper's choice
When your product page has its own colour picker, change variant-id as the shopper picks. The element starts again with the new variant:
document.querySelector('#colour').addEventListener('change', (event) => {
document.querySelector('vizbl-core').setAttribute('variant-id', event.target.value)
})Camera
These attributes change the 3D viewer that ar-viewer opens. AR places the product in the shopper's room instead and ignores them.
| Attribute | What it sets | Example |
|---|---|---|
camera-orbit | Where the camera starts | 30deg 75deg 105% |
min-camera-orbit | The lowest angles and distance the shopper can reach | -90deg 45deg auto |
max-camera-orbit | The highest | 90deg 90deg auto |
Each value is three parts, theta phi radius, as in Google's <model-viewer>:
- theta turns the camera around the product, in degrees:
0degfaces its front,90degits right side. - phi tilts it from straight above:
0deglooks down from the top,90deglooks from the side. - radius is the distance, in metres such as
2mor as a share of the distance that fits the product, such as105%.autokeeps the default.
<vizbl-core
api-key="pk_live_YOUR_PUBLISHABLE_KEY"
type="ar-viewer"
object-id="YOUR_OBJECT_ID"
camera-orbit="30deg 75deg 105%"
min-camera-orbit="-90deg 45deg auto"
max-camera-orbit="90deg 90deg auto"
></vizbl-core>This opens the product slightly from the right and from above, and lets the shopper turn it a quarter each way without seeing it from below. When the minimum and the maximum are equal on a part, that part is locked: min-camera-orbit="auto 75deg auto" with max-camera-orbit="auto 75deg auto" keeps the tilt fixed.
The Core AR dashboard has the same three fields under Camera angle when you choose Install on 3D & AR viewer: try values there and copy them from its code.
Dimensions
The 3D viewer can show the product's width, height and depth.
| Attribute | Values | Default | What it does |
|---|---|---|---|
size-type | cm, inch | inch | The unit the dimensions are shown in. |
dimension-axes | x, y, z, separated by commas | x,y,z | Which dimensions are drawn. |
<vizbl-core
api-key="pk_live_YOUR_PUBLISHABLE_KEY"
type="ar-viewer"
object-id="YOUR_OBJECT_ID"
size-type="cm"
dimension-axes="x,y"
></vizbl-core>size-type with another value makes the button fail with INVALID_SIZE_TYPE. An unknown letter in dimension-axes is skipped, and a value with no known letter draws all three.