How a character works
A character is a GameObject with a Character Motor, and one child GameObject per module.
Every step, at a fixed rate (60 steps a second for third-person characters, 125 for the arena shooter):
- A command source reads the input: where to move, where to look, which buttons are held. A player, a bot and a test are the same to the character.
- The sensors look at the world: the ground under the feet, the water, ladders and triggers around.
- The motor asks every state whether it may run, and runs the highest-priority one. A state owns the body: it decides the velocity.
- The modifiers adjust: they forgive a late jump, add speed to a running jump, keep the character on the ground.
- The solver moves the character's hull (its collision shape) through the level, sliding along walls and stepping up stairs.
Because every step is the same length, the same input always gives the same result. A recorded run replays exactly, and the gyms' bots can test a jump to the centimetre.
| Kind | What it does | Examples |
|---|---|---|
| Command source | Turns input into commands. | Input System Command Source |
| Hull | The character's collision shape. | Capsule Hull, Box Hull |
| Solver | Moves the hull through the level. | Step Slide Solver |
| Sensor | Reads the world. | Hull Ground Sensor, Trigger Sensor |
| State | A mode or an action; one runs at a time. | Walk, Jump, Ledge Grab |
| Modifier | Changes states, never owns the body. | Coyote Time, Sprint |
| Gameplay | Health, damage, respawning. | Health, Fall Damage |
| Presentation | What the player sees. | Third Person Orbit, Facing Visual |