Getting started

System Requirements

Rendering

Vectary Dashboard

Account Settings

Roles

User Interface

Scene Orientation

Units

How To Get Help

Importing

Import formats

Figma frames import

CAD files

Processor

Design process

Design mode

Materials and Textures

Animated Materials

Decals

UV mapping

Camera

Lighting and Environment

Effects

Background

Ground plane

Control Bar

Libraries

Edit mode

3D Configurator

Variants

Interactions

Animations

Floating UI

Hotspots

Variables & Expressions (Beta)

Scene and project settings

Version History

Augmented Reality (WebAR)

WebXR (beta)

Loading screen

Mouse controls

Interaction prompt

Menu - Settings

Sharing, exporting, embedding

Sharing

Performance analyzer

Optimizing a shared project

Project cloning

Embedding to other software

Export options

Other

Figma Plugin - Vectary 3D Studio Lite

2D to 3D

Adding comments

Object Editing

Left bar

Shortcuts

Model API

Introduction

Quick Start

Events & Listeners

Floating UI Configurators

Ecommerce

Events (trigger and action)

Interactions

Introduction

Events allow external communication with a project by adding to interactions, enabling connections between the project and external environments.

Events enable cross-communication with a website through the Model API:

Events are configured in interactions (Interact mode) and can be added to triggers and actions:

This enables bidirectional data exchange, allowing a model embedded on a site to send information externally and react to incoming data.

<aside> <img src="/icons/thought-alert_gray.svg" alt="/icons/thought-alert_gray.svg" width="40px" /> Event names must be unique - duplicate event names are not allowed, even across different types.

</aside>

Events as Triggers

Events can be used in triggers. If an event with a matching name is dispatched (either from an action or the Model API), it activates the trigger within its interaction.

Events as Actions

Events can be used in actions for dispatching and transmitting data.

Debugger

Debugger enables event dispatching within Studio, simulating external API calls from the Model API. Enter a value and activate it by clicking the radio button.

Debugger also displays variable values and changes.

Debugger tab appears in Preview mode if at least one event exists.

image.png

Embed code

Once an event is created, the embed code in the Share popup includes a script (in addition to the standard iframe). This script should be added to the site for dispatching and listening to events.

image.png

<iframe
  id="VECTARY_EMBED_ID"
  src="<https://app.beta.vectary.com/p/{model_id}>"
  frameborder="0"
  width="100%"
  height="480"
></iframe>

<script type="module">
  import { VctrModelApi } from "<https://app.beta.vectary.com/studio-lite/scripts/api.js>";
  const modelApi = new VctrModelApi("VECTARY_EMBED_ID");
  await modelApi.init();

  // Example of listening to events sent from Vectary
  modelApi.addEventListener("event_name_1", value => { 
    console.log(value);
  });

  // Example of sending an event to Vectary
	modelApi.dispatchEvent('event_name_2', 'hello');
</script>

The script includes the following information: