Space and transforms
A transform is three numbers, three times
Section titled “A transform is three numbers, three times”Anything with a place in the world has a transform component, and a transform is three things:
| Field | What it is | Starts at |
|---|---|---|
| Position | Where it is: X, Y, Z. | 0, 0, 0 |
| Rotation | Which way it faces, in degrees around X, Y and Z. | 0, 0, 0 |
| Scale | How big it is along each axis. 1 is its normal size, 2 is double. | 1, 1, 1 |
Studio’s Inspector shows these as initial_position, initial_rotation and initial_scale, because they’re where the
entity starts. A script can move it afterwards; a level only says where it begins.
Centimetres, and Z is up
Section titled “Centimetres, and Z is up”The game measures in centimetres, and Z points up. X and Y are the two directions along the ground.
So one metre is 100 units. Two numbers to hold on to:
| Thing | In game units |
|---|---|
| A character, head to toe | about 154 |
| A whole map, side to side | about 12,000 |
Positions are measured from the parent
Section titled “Positions are measured from the parent”An entity’s position isn’t measured from the middle of the map. It’s measured from its parent. A lamp at position (0, 0, 250) under a lamp post is 250 above the post’s own origin, wherever the post stands.
- lamp_posttransformmodelposition 1200, 400, 0
- bulbtransformmodelposition 0, 0, 250: always 250 above the post
- glowtransformeffectposition 0, 0, 240
Grouping works the same way: move a parent and everything under it moves too, keeping its arrangement. And the same number can mean different places. (0, 0, 0) under one parent and (0, 0, 0) under another are wherever those parents are.
Scale passes down too
Section titled “Scale passes down too”Scale is inherited like position. A parent at scale 2 makes everything under it twice as big, including its children’s distances from it.
Invisible shapes feel this most. A trigger box’s size is multiplied by the scale of its entity and of every parent above it, so a trigger that looked right on its own can become enormous when you put it under a scaled parent. See Collision and triggers.
For programmers
Z-up, centimetres. Each transform is local to its parent and composes down the tree. Rotation is stored as a quaternion; Studio shows and edits it as Euler angles in degrees. Non-uniform scale on a parent with rotated children produces shear, which the transform has nowhere to store, so keep uneven scale on leaf entities.
Where to go next
Section titled “Where to go next”Kinds of level: a map is several levels stacked together.