The hierarchy in the Entities panel makes it possible to make entities follow their parent entities when moved by connecting their 3D Transforms in a hierarchy or nesting structure. In this tutorial, we’ll explore the basics of the Entities panel hierarchy and its effect on Transform values by using simple primitive shapes.
You’ll learn about:
- Entities panel
- 3D Transforms
- Local and global coordinates
Before you begin, you should have completed the following tasks and tutorials:
- Sign in to Amazon Sumerian with your AWS account
- Amazon Sumerian Interface tutorial
- Sumerian Basics: Creating a TV Room
Create a New Scene
From the Dashboard, navigate to the scene Templates, and then choose the Default Lighting template. This scene comes with a Camera, a Light, and a Skysphere (this is what makes the environment look like a blue sky).
Understanding 3D Transforms
All entities in the 3D world have a Transform. The Transform contains information about the entity’s Translation (or position), Rotation, and Scale. All these quantities are in the form of vectors on the X, Y, and Z vertices and are handled by the Transform component. The following two examples illustrate this.
An entity might have the Translation (5, 0, 0). That would mean that it’s positioned 5 units along the X axis away from its origin, which is (0, 0, 0).
If we had a Cone at origin (0, 0, 0) and a box had a Translation of (1, 2, -3), that means it’s moved 1 unit to the right (X,1), 2 units up (Y, 2), and 3 units back (Z, -3). If we switched the positives and negatives in our last example (i.e., -1, -2, 3), our box has moved 1 unit to the left (X, -1), 2 units down (Y, -2), and 3 units forward (Z, 3).
Local and Global Coordinates
There are two Transform types, or sets of coordinates. It’s important to keep track of both: local and global Transforms. The global transform is how we have mapped the scene with its origin in the middle of the Sumerian scene, at (0, 0, 0). It’s the center of the entire scene.
The local transform is the center of an entity and is how each entity is transformed relative to itself (or its parent, if it’s nested). If we take a look at the Entities panel hierarchy, we see that all entities need to be children of the scene. That’s because initially, all Transforms are directly relative to the scene. If we add an entity, it will have the local Translation (0, 0, 0) and the global Translation (0, 0, 0). To illustrate, complete the following steps.
Create a new Box from the Create Entity menu. Initially, it is a child of the scene only, placed in the origin (0, 0, 0).
As we build deeper hierarchies, things will change a little. Add another entity, a Sphere, and change the Scale to (1.25, 1.25, 1.25). You’ll see that the Sphere and the Box have the same coordinates.
Nest the Sphere within the Box by dragging and dropping it on the box in the Entities panel.
Using Transform gizmos or the Transform component, move the Sphere along the X axis by -3.
Move the Box in any direction and notice that the Sphere follows.
The Box’s coordinates will naturally change, but what happens with the Sphere? If we take a look at the Translation values, nothing has changed even though the Sphere is clearly in a new position. This is because what we see as Transform values are the local coordinates. The Sphere’s local coordinates are relative to the Box, and the Sphere is only connected to the Box. The global Transform is changed because the Sphere’s actual position within the scene has changed.
Related Tasks and Tutorials
You should now have a much better understanding of the Transform component, entity hierarchy, and local and global coordinates. To learn more about this topic, see the following tutorials: