Skip to content

Gameplay components

Most components describe how a thing looks or how it collides. This page covers the ones that decide how a map PLAYS: where players start, what hurts them, what they can swim in, what they can climb, and where they are allowed to go.

They are all engine behaviour, not script behaviour. Add one in the Inspector and it works in the editor play-test, in a standalone build and in multiplayer, with no code. Most of them can also be changed at runtime with entity.setComponent(...) — a ladder switched off, a hazard made harmless partway through a level — but nothing here needs a script to function.

Add any of them by selecting an entity and clicking Add Component in the Inspector.

At a glance

ComponentPut it onWhat it does
spawnAn empty markerWhere players enter the map
damageZoneThe hazard itselfHurts or kills a player standing in it
climbableThe ladder or truss meshPlayers climb it
waterZoneA box shaped like the poolPlayers swim in it
boundaryBoxAn empty marker, sized to the play areaKeeps players inside it
healthAny entityGives it hit points that scripts can damage
collider.isTriggerA collider you can walk throughFires script hooks on overlap

A note that applies to all of them: a zone's SIZE comes from the entity's scale and its collider, not from a field on the component. Scale the object in the viewport and the zone follows.

Spawn points

json
{ "spawn": { "type": "player", "order": 0 } }

Put one on an empty marker. Players arrive facing the marker's forward direction, so rotate it to aim them at whatever they should see first. Add several and players are scattered between them rather than stacked on one point, which matters as soon as more than one person is in the map.

A spawn is a pad, not a point: its X and Z scale set how wide the arrival area is.

Checkpoints

A checkpoint is a trigger plus a script, not a component. Give the pad a trigger collider and call players.setRespawnPoint when a player crosses it:

js
class Checkpoint extends Behaviour {
  order = 1
  onPlayerEnter(player) {
    const cur = this.players.getProperty(player.id, 'stage')
    if (typeof cur === 'number' && this.order <= cur) return   // never move a player backwards
    this.players.setProperty(player.id, 'stage', this.order)
    const p = this.entity.position
    this.players.setRespawnPoint(player.id, [p[0], p[1] + 1, p[2]])
  }
}

From then on, dying returns that player to the pad. players.setRespawnPoint(id, null) clears it, so a finish line can send everyone back to the start, and players.getRespawnPoint(id) answers null until a player has reached one. The point is per player and lasts as long as they are in the game. Everything else — which pad claims whom, in what order, what it says on screen — is the script's, which is what lets a race clear progress at the finish and an obby keep stage numbers of its own. The Obby Kit ships a ready-made Checkpoint prefab wired this way.

Damage zones

json
{ "damageZone": { "damage": 25, "interval": 1 } }

Put it on the hazard itself — the lava slab, the spike, the saw blade. Standing in it costs damage hit points every interval seconds. For something that should kill outright:

json
{ "damageZone": { "damage": 100, "interval": 1, "killOnEnter": true } }

The damaging region is the entity's collider, so a thin lava pool hurts you when you stand on it, not only when you are buried in it.

Ladders, trusses and climbable walls

A ladder is not a special kind of object. It is an ordinary box you scaled tall and thin, with one component added. There is no separate trigger volume to place and keep lined up: the climbable region is taken from the object itself, so the thing players can see is the thing they can climb.

Build one in four steps

Say you want a ladder up the front of a wall, onto the roof.

  1. Make the wall. A box at position [0, 2, -0.7] scaled [4, 4, 1]. It stands from the ground to y = 4.
  2. Make the ladder. A box at position [0, 2, 0] scaled [1, 4, 0.2] — one unit wide, four tall, a fifth of a unit thick. Note it is the SAME height as the wall and sits just in front of it.
  3. Make the roof. A box whose top surface is at y = 4, the same height as the top of the ladder: position [0, 3.95, -2.2], scale [4, 0.1, 3].
  4. Select the ladder, click Add ComponentClimbable, and press Play.

Walk at the ladder and you climb it. Keep holding forward at the top and you step onto the roof.

Three numbers in that recipe are doing the work, and they are the ones to copy:

  • The ladder is IN FRONT of the wall, not buried in it. Its front face has to be reachable.
  • The ladder's top and the roof's top are the same height (both y = 4). This is what makes climbing over the top put the player on the roof instead of leaving them stranded.
  • The ladder is thin. Thickness does not affect climbing, but a thick one is a wide platform players can stand on top of, which reads oddly.

Which way does it face

Front is the side players climb from — the side pointing away from whatever the ladder is mounted on. It is expressed in the ladder's OWN axes, which is the part that trips people up.

The easy way to avoid thinking about it: leave Front at its +z default and ROTATE the ladder in the viewport so its front points at the player. A box's local +Z is the face you see when you look at it from the front view, so rotating the object is the same as changing the axis and much easier to check by eye.

Change Front only when you would rather not rotate — for instance a wall-shaped box that is already oriented the way you want it:

The ladder is mounted on a wall to its...Set Front to
back (-Z)+z (the default)
front (+Z)-z
left (-X)+x
right (+X)-x

If players walk into the ladder and simply stop, Front is pointing the wrong way — they are pushing at its back. Rotate the ladder 180 degrees, or flip the axis.

How big the climbable region is

The region is the ladder's collider, grown by reach (0.45 by default) in every horizontal direction and upward over its top. Two consequences worth knowing:

  • Scale the ladder taller and the climb gets taller. Nothing else to change.
  • If the object has no collider component, its own size is used instead. Give a ladder a collider anyway, so players cannot walk through it — a ladder you pass straight through looks broken even though it climbs perfectly well.

What the player can do

InputWhile on a ladder
Move toward the ladderClimb up
Move away from itClimb down
Move sidewaysShimmy across the face
JumpLet go, pushing off the wall
NothingHang still — the climbing animation stops with you

Gravity does not apply while a player is holding on, and the avatar turns to face the rungs whatever the camera is doing.

Moving away from the ladder climbs DOWN rather than letting go, which is the one rule worth reading twice. There are four ways off: jump, walk off the side, reach the bottom, or climb over the top.

Getting ON at the top is the mirror of that: standing on the roof, walk backward off the edge toward the ladder and you will catch it and start descending. You do not have to jump down.

A jump key that was already held when a player grabs on does not count as a press, so jumping at a ladder and keeping the key down lands you on it instead of bouncing off. Release and press again to let go.

Common layouts

A free-standing truss tower. One tall box, climbable added, Front pointing at wherever players approach from. Scale it as tall as you like. For a tower climbable from all four sides, use four thin boxes back to back, each with its own Front; players attach to whichever one they walk into.

A ladder down into a pit. Build it exactly like the wall version, with the ladder's top level with the pit's rim. Players back off the rim onto it and climb down. Give the pit floor something to stand on and they will step off the bottom automatically.

A ladder that catches people falling past it. This is on by default (Catch falling players). It is what makes a truss beside a long drop feel generous. Turn it off for a decorative ladder next to a shaft players are supposed to fall down, or they will keep grabbing it by accident.

A ladder that only works later. Uncheck Climbable in the Inspector and it becomes an ordinary wall; a script can switch it back on with setComponent when a puzzle is solved.

Every field

FieldDefaultWhat it does
face"+z"The ladder's front, in its own local axes. Sets which way the avatar turns and which input direction climbs up.
speed3.5Climb speed in units per second, about half of walking. Raise it for a fast obby, lower it to make a climb feel like effort.
reach0.45How far past the surface a player can grab from. Raise it for a lattice players should catch from further out.
catchOnFalltrueA player falling past it grabs on.
enabledtrueUncheck to switch the ladder off without deleting the component.

When it does not work

What you seeWhy
Player walks into it and stopsFront points the wrong way — they are at its back
Player climbs but ends up stranded at the topThe ladder's top is not level with the platform. Match their heights
Player walks straight through the ladderNo collider on it. Add one — climbing works, but nothing is solid
Players grab it by accident while falling pastTurn off Catch falling players
Nothing happens at allThe component is unchecked, or it is on the wall rather than on the ladder

Water

json
{ "waterZone": { "fluidType": "water", "drag": 0.5, "buoyancy": 12 } }

Put it on a box scaled to fill the pool. Players inside it swim: hold jump to rise, the walk key to dive, and let go to sink slowly. Horizontal movement is slowed.

FieldDefaultWhat it does
fluidType"water"water, lava, acid or liquid_nitrogen — picks the surface shader
drag0.5How thick it is, so how slowly you sink when you stop swimming
buoyancy12How hard you can swim upward. Low values make a pool hard to climb out of
colorper fluidTint
animatedtrueWhether the surface moves

Water is also generated from terrain sea level and from lakes in an imported voxel build, with no component needed — those swim by the same rules.

Lava is a surface, not a hazard. Add a damageZone alongside it if it should hurt.

Boundary boxes

json
{ "boundaryBox": { "behavior": "block", "size": [200, 100, 200] } }

An invisible volume that keeps players inside the play area. Put it on an empty marker at the centre of the map.

behaviorResult
blockPlayers slide along the inside face — an invisible wall
killLeaving it kills the player
teleportToSpawnLeaving it sends them back to the start

restrictX, restrictY and restrictZ (all on by default) let a boundary act on some axes only — turn off restrictY for a box that walls the sides in but lets players jump as high as they like. padding shrinks the effective volume inward.

Health

json
{ "health": { "max": 100, "destroyOnDeath": true } }

Gives an entity hit points. Scripts damage and heal it through game.damageEntity and game.healEntity; the entity's script gets onDeath() at zero, and the entity is removed unless destroyOnDeath is off. Use it for enemies and destructible props.

Trigger zones

A trigger is not its own component — it is a collider with isTrigger checked. The collider stops being solid and instead reports overlaps, which the attached script receives as onPlayerEnter, onPlayerLeave, onTriggerEnter, onTriggerStay and onTriggerExit.

Two mistakes are worth naming, because both produce a zone that looks right and does nothing:

  • A trigger with no script on it fires nothing. The hooks live on the entity's own script.
  • A script with onPlayerEnter on an entity whose collider is NOT a trigger never fires, because the player is stopped by the wall before overlapping it.

The map validator flags both.

Checking your work

Every component on this page has the same failure mode: the map looks finished and does not play. A lava slab with no damageZone is a warm-coloured floor. A ladder with no climbable is a wall. A trigger with no script fires nothing.

The AI editor checks for exactly these while it works — ask it to change anything and it sees the warnings for the whole map, so it will usually tell you about a hazard that hurts nobody even if you asked it about something else. There is no separate button to press.

The reliable check is still the one that costs nothing: press Play and try the thing. Walk into the lava, walk into the ladder, walk off the edge.