This tutorial shows you how to import an animated 2D velociraptor and create a small herd that runs across the screen. This technique can be useful for creating crowds, efficient lightweight characters, or props (such as plants and clouds) to enhance the environment in your scene. These velociraptor assets were made from 2D character “atlas” sheets (.psd files), then rigged and skinned.
You’ll learn about:
- How to use a State Machine to move an entity across the screen.
- How to incorporate an animated 2D character into an Amazon Sumerian scene.
- How to modify instances of the entity to create variety within the collection of entities.
This is the scene we will create. For best results, use the latest version of your web browser.
Before you begin, you should have completed the following tasks and tutorials:
- Sign in to Amazon Sumerian with your AWS account
- Scripting Basics tutorial
- State Machine Basics tutorial
Step 1: Import the Velociraptor into Your Scene
In this step, we will download a velociraptor asset and import it into our scene.
Download the velociraptor assets.
Create a new Sumerian scene from the Sumerian Dashboard.
When your scene is loaded, drag the aws_velociraptor_walk_maya-2.fbx file into your scene’s Assets panel. You’ll see the asset populate in your Assets panel.
Step 2: Setup the Velociraptor Entity
In this step, we setup our Entities hierarchy and then add the velociraptor asset and an empty entity to our scene.
Drag the entity aws_velociraptor_walk_maya-2.fbx (hexagon icon) from the Assets panel to the Entities panel.
Above the canvas, choose Create Entity. Then add a new, empty entity. Rename it “Velociraptor_Entity”.
Drag the aws_velociraptor_walk_maya-2.fbx entity onto the empty Velociraptor_Entity.
This makes the aws_velociraptor_walk_maya-2.fbx entity a child to the parent Velociraptor_Entity. This also helps separate some of the functionality we’ll use to control the velociraptor’s path across the scene grid.
Choose aws_velociraptor_walk_maya-2.fbx. Navigate to the Inspector panel and scroll down to the Default Animation Layer. Make sure that you see an animation named Take 001, and that the Default label is blue. This indicates that this will be the animation that’s played back.
Check the Loop Infinitely checkbox.
Update Blending Property
At this stage, you might notice that the velociraptor entity is surrounded by what appears to be a pixelated background.
To fix this, find and select the meshNode_plain entity, nested under the Velociraptor_Entity.
Navigate to the Inspector pane. Under the Material component and find the Blending property. Open the dropdown menu and select TransparencyBlending.
Step 3: Create a Simple State Machine Behavior
In this step, we create a simple State Machine behavior that will only have one state and one actions.
Select the Velociraptor_Entity, add a State Machine component, and add a behavior. This opens the State Machine editor. Rename the behavior “Locomotion Behavior”.
Choose Add Action. Search for and then add a Move action to State 1. Leave the default settings as they are, with Oriented, Relative and On Every Frame all selected.
Leave all the Translation values in the Move action at (0, 0, 0).
Step 4: Duplicate the Velociraptor
In this step, we create multiple copies of the velociraptor with small variations to their Transform values.
With the Velociraptor_Entity selected, make duplicates by choosing Duplicate at the top of the Entities panel. Make four velociraptors.
In the Entities panel, the duplicates will look roughly like this.
Offset the velociraptor entities from one another by modifying each of the top-level entity’s Transform values.
We adjust them in both X and Z directions so they don’t ever pass through one another. You can experiment and find the right numbers that work for your scene. Here are the Velociraptor_Entity Transform values used for this tutorial. Note: They don’t need to be exact.
- Velociraptor_Entity: Translation (0, 0, 0.69)
- Velociraptor_Entity 2: Translation (-0.049, 0, 0.69), Scale (2, 2, 2)
- Velociraptor_Entity 3: Translation (-0.148, 0, 0.38), Scale (1.75, 1.75, 1.75)
- Velociraptor_Entity 4: Translation (0.29, 0, 0), Scale (0.5, 0.5, 0.5)
Your scene should look similar to the following.