Getting Started Tutorial


Transform Hierarchy


15 minutes

Posted on: October 9, 2017

Learn Sumerian
Transform Hierarchy

Tags

Hierarchy
3d transform
coordinates

In this tutorial you will learn about:

Hierarchy
Local and global coordinates

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
  • Hierarchy
  • 3D Transforms
  • Local and global coordinates
  • Nesting

Prerequisites

Before you begin, you should have completed the following tasks and tutorials:

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.

  1. 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).

  2. 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.

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:

Back to Tutorials

© 2019 Amazon Web Services, Inc or its affiliates. All rights reserved.