Mattercraft structure
Mattercraft structures your project using a few different concepts:
Nodes
Nodes are the basic elements of your scene - these are the groups, 3D models, cameras and more that make up your experience.
In Mattercraft, your project scenes are made up of a tree of nodes called the Hierarchy.
If you have explored the Mattercraft editor, you may already be familiar with this tree as it is shown to the right of the 3D Viewport. Each node in the Hierarchy is an instance of a Component.
Components
Components are the different types of node you can have in your scene. There are many components included with Mattercraft, and many more can be added through other libraries.
Examples of components include Group
, Box
, and PerspectiveCamera
. Each component provides a set of functionalities and properties which you can add as many times as you like - in the form of Nodes - to your project’s Hierarchy.
Behaviors
Behaviors are scripts that can be attached Nodes. They’re typically used to add interactivity, such as to perform actions when the user taps on a node.
Learn more about adding interactivity to your Mattercraft project with Behaviors by taking a look at our Adding interactivity documentation.
Contexts
Contexts are scripts that store state and functionality that can be accessed anywhere in the Components and Behaviors across your project.
Contexts are great for handling the ‘business logic’ of your experience, and for keeping track of global concepts such as high scores.
zcomp
All Mattercraft projects contain at least one zcomp file, typically named Scene.zcomp
by default.
zcomp files store your current scene setup, including the Hierarchy, Nodes, and Animations.
You can separate functionality or different parts of your projects by using individual zcomp files. This is particularly useful when you want to reuse specific setups in different projects or keep your project organized and easier to maintain.
Continue your Mattercraft journey by reading the rest of our in-depth documentation.
Next article: Customizing the splash screen