Mattercraft has powerful tools for setting up interactivity and simplifying frequently used functionality without writing any code called Behavior Actions.
These actions are part of the broader Behaviors category, which also encompasses Custom Behaviors. The main difference is that Behavior Actions attach to an event instance such as
Adding a Behavior Action
You can easily add Behavior Actions from the Behaviors Panel. Just click on the + (plus) icon, and a list of contextual behavior actions related to the currently selected node will appear.
Behavior Actions offer simple yet robust pieces of functionality that, when added, expose relevant editable properties in the interface.
The list of available actions goes beyond the example below and hovering over each action provides a detailed explanation of its purpose and functionality.
Some of the available actions include:
Example Behavior Actions
|Set the visibility of the node based on an emitted event.
|Launch Web XR Session
|Initiates a WebXR session.
|Activate a defined camera when an event is emitted.
|Captures the canvas as an image. This image can then be shared or downloaded using other behaviors.
|Show Text Alert
|Display a customizable text alert when an event is emitted.
|Shares the captured canvas using the Web Share API.
|Plays a sound.
|Log Analytics Event
|Logs an event through the currently configured analytics provider(s). You must have added an analytics provider to the Hierarchy in one of your components for this behavior to have any effect.
|Downloads the captured canvas as an image.
|Launches a URL when an event is emitted.
|Outputs a message to the console log.
As well as Actions, you can find a number of other helpful, easy to use behaviors in the dropdown, some of which are detailed below:
|Change the opacity of a given node and its children, allowing you to control its transparency easily.
|Surround the node with a bounding box, which is highly useful for debugging and visualizing the spatial boundaries of the node.
|Toggle Layer Clips
Set Layer Off
Play Layer Clip
Pause Layer Clip
|Easy ways to activate and play Clips (States and Timelines). For more information, see the Animation System documentation.
Play Stream Pause Stream
|Enable you to play, pause, stop, and seek streamed tracks, including 3D model animations, videos, and audio clips.
Creating Custom Behaviors
You can also create your own Custom Behaviors. Custom behaviors are great for developing templated functionality you want to reuse across multiple projects or use multiple times in a single project.
To learn more about how to setup a custom behavior, we recommend reading the Creating Custom Behaviors article.