Collision and triggers
What you see isn’t what you hit
Section titled “What you see isn’t what you hit”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:
- A collidercollider: An invisible shape that things bump into: walls, floors, props. The player never sees it, only stops at it. stops things. Walls, floors, the crate you can’t walk through.
- A triggertrigger: An invisible shape that notices things entering it but doesn't stop them. Teleport pads and kill zones are triggers. notices things. It doesn’t stop anything; it tells the scripts beside it that something came in. Teleport pads, kill zones, the area that counts as “on the roof”.
Both are components on an entity, sized and placed by that entity’s transform.
The shapes
Section titled “The shapes”| 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.
Size is half-size, times scale
Section titled “Size is half-size, times scale”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.
Moving colliders
Section titled “Moving colliders”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.
Triggers and scripts
Section titled “Triggers and scripts”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.
Seeing them in Studio
Section titled “Seeing them in Studio”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.
Where to go next
Section titled “Where to go next”Models: how the world looks.