Skip to content

Collision and triggers

A model is only a picture. Players walk through it and balls fly through it, unless something invisible is there too. Levels are full of invisible shapes, and they come in two families:

Both are components on an entity, sized and placed by that entity’s transform.

Shape Collider Trigger Size is set by
Box physics_box box_trigger half its width, depth and height
Sphere physics_sphere sphere_trigger its radius
Capsule physics_capsule a radius and a height
Cone physics_cone cone_trigger a radius and a height
Cylinder physics_cylinder cylinder_trigger two extents (which is the radius isn’t pinned down yet)
Mesh physics_arbitrary_mesh, physics_convex_mesh a collision mesh file

Plenty of the game’s own scripts build on these, so a component you’ve never heard of can still be a trigger. A collectible is a sphere trigger underneath; a ball’s physics is a sphere collider.

A whole map’s walls and floors usually come from one mesh collider in the map’s collision level, rather than thousands of boxes. Studio can’t make a new collision mesh yet, so to block off a new area, place boxes.

A box’s size field holds half its extents: a box of 50 is 100 across. On top of that, the size is multiplied by the entity’s scale and by every parent’s scale above it.

The shipped hideout uses this deliberately: its boxes keep the default size and set their size by scale alone. It’s the easiest way to size a box in Studio too: leave the box’s own numbers alone and scale the entity.

A collider has a dynamics type:

Type Means
Static It never moves. Almost every collider in a map is static.
Kinematic It moves because something moves its entity: a platform, a door.
Dynamic Physics moves it: it falls, gets knocked around, rolls.

Shipped maps use static for scenery and kinematic for moving parts.

A trigger doesn’t do anything by itself. When something enters it, it tells the other scripts on the same entity, and those decide what happens. So a teleport pad is a box_trigger and a teleport script on one entity. The vscript cookbook shows how a script listens.

Invisible shapes are hidden in the viewport until you ask for them:

  • View▸Volumes▸Colliders ShiftC shows colliders.
  • View▸Volumes▸Triggers ShiftT shows triggers.

Each is a toggle, so the same key hides them again: ShiftC and ShiftT while the viewport has focus.

For programmers

Physics is Bullet. Box sizes are half-extents, and the collider offset is applied inside the entity’s scale, so box and offset scale together. The dynamics type is an int: 0 dynamic (the default), 1 kinematic, 2 static. A trigger delivers its overlap as an event to the sibling components on its entity.

Models: how the world looks.