The State machine is one of the most useful components in Amazon Sumerian. Without it, most of the scenes you create would be stagnant 3D models. The State Machine enables you to create behaviors and interactivity between the user and entities within a scene. With a large library of Actions, the Amazon Sumerian State machine provides a node-based editor to create logic that drives behaviors.
I recently demonstrated Sumerian at an event and used the Alarm System scene to give attendees a taste of the capabilities that the Sumerian State machine provides. This article walks through how to recreate that same scene and most important, it is built without writing a single line of code!
About the State Machine
But first, let’s be sure you understand a few things about the State machine. There are several important terms related to it and a hierarchy of how they all work together. The State machine itself is the component you can add to any entity. It’s the editor you use to build behaviors, which are (usually) composed of multiple states. In the Alarm System scene, we will have four behaviors: a flag going up and down, lights flashing, an alarm sound playing, and to initiate those three behaviors, a message emitted when the mouse/cursor hovers over a box.
How do we create behaviors created? Let’s consider the flag going up and down. The flag will have two states: up and down. Each state (up and down) will have actions that transition to the other. So here is how to understand it:
- Actions trigger transitions between states.
- Transitioning from state to state creates behaviors.
- Behaviors create scene interactivity.
- The State machine is the component/editor you use to build behaviors.
If this concept is still confusing, it will soon become clear.
Note: For best results, use Firefox Quantum 57.0 as your web browser.
If you’re just getting started with Amazon Sumerian, this article and project are a great place to help you understand many of the basics. However, I’ll assume that you know the interface and some basics about lighting.
Therefore, to get familiar with the interface, I recommend you work through most of the Getting Started tutorials and a few Beginner tutorials, especially the following:
- Amazon Sumerian Interface
- Amazon Sumerian Basics: Creating a TV Room
- Camera and Lights
- State Machine Basics
You’ll also need to have a short sound file (.mp3 or .wav) available on your computer.
Set up the Scene
We don’t need to use a scene template for this project. Open an empty scene. However, we’ll want to add a light to the scene so we can see.
Above the canvas, choose Create Entity. Then, add a Directional Light. Once your new light is in the scene, change the name to “Directional Light” and rotate the X Rotation value to -45.
Remember that Directional Lights mimic a light source from an infinite distance (i.e., the sun). This means that the Translation values don’t alter the lighting in the scene. Only the Rotation affects Directional lights. However, although it’s not necessary, I prefer to move the light out of the way (with Translation values of 0, 0.95, 0.95), because I find it visually distracting if it’s placed in the middle. Use the Translation gizmo handles to move the light.
Adding Some Basic Entities and Assets
Next, we’ll add a Box to our scene, by choosing Create Entity and selecting Box. Then, we’ll change the Transform values to something like the following, making it a very flat box.
Note: Your values don’t need to precisely match those shown.
You can also change the color of the Box by expanding the Material component (in the Inspector panel on the right), and changing the color in the Color (Diffuse) property. I’ll use a shade of blue.
Note: You can choose any color.