Skip to content

Components

Collider

A solid shape that blocks movement, or an outline traced around art for a closer fit. Walls, floors and anything a character stands on or bumps into.

On this page

Add it

+ Add node → Block, Collider, Sprite Shape creates a node with it already on. Already have a node for it? Add component → ColliderComponent.

From a script

A script on the same node writes these fields by name. ColliderComponent is the name to pass.

rgs
set_point("ColliderComponent", "size", vec2(64.0, 64.0));
set_number("ColliderComponent", "polygon_step", 32.0);
set_point("ColliderComponent", "offset", vec2(0.0, 0.0));
set_flag("ColliderComponent", "solid", true);
set_flag("ColliderComponent", "one_way", false);

Fields

FieldScript nameKindDefaultWhat it does
Kindkindone of Rectangle, Circle, CapsuleRectangleWhich shape.
Sizesizetwo numbers (x, y)(64, 64)Size in local units.
Polygon
OutlinepolygonsectionemptyPoints replace the box; empty leaves the box alone.
Steppolygon_stepnumber, at least 032 uHow long each collision box is where a slanted outline, or a solid circle or capsule, is cut into boxes: in the node's own units, or the world's on a turned node. Shorter follows the curve more closely and costs more boxes; zero cuts nothing, so a round solid is about its box again.
Offsetoffsettwo numbers (x, y)(0, 0)Offset from the node origin.
SolidsolidcheckboxonWhether this blocks movement. Off, it stops nothing and notices nothing: an Area is what notices bodies.
One Wayone_waycheckboxoffOnly stops a body falling onto it from above.
Layerlayernumber1Which collision layers this is on: what the collision matrix, casts and queries go by.
Include Layersinclude_layersnumber0A body on one of these layers meets this whatever the collision matrix says. It is not put on them. Exclude Layers beats it.
Exclude Layersexclude_layersnumber0A body on one of these layers passes through this. It stays on its Layer. Beats Include Layers.
MaterialmaterialsectionnoneFriction and bounce; empty stops a body dead.
FieldScript nameKindDefaultWhat it does
Frictionfrictionnumber, at least 0, step 0.05none0 is ice, 1 is ordinary ground.
Bouncebouncenumber, 0 to 1, step 0.05none0 stops dead, 1 is elastic.