Skip to content

Search

Documentation

tile_collision

Collision for the node's tilemap cells: every tile the tileset marks solid, one shape per behaviour, with the material keys a collider2d takes. mass…

Pe această pagină

2d · physics · 26 properties · 2D

Collision for the node's tilemap cells: every tile the tileset marks solid, one shape per behaviour, with the material keys a collider2d takes. mass weighs the whole map, shared across its colliders by area; one_way makes every cell a platform, holding bodies on one_way_axis.

In a scene, tile_collision is the node key that applies it. A script reaches each property below as a field on node.tile_collision: reading one asks the running component, and assigning one leaves the rest alone. The whole table is node.tile_collision.get() and node.tile_collision.set(table).

Properties

property type default description
center_of_mass vec2 [0,0] Where the whole map's mass sits, in the node's own space; read with inertia, and both 0 keep the shapes' own
collision_layer flags ["1"] The layers this collider is on One of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32.
collision_margin float 0 A margin the solver treats as already touching; stops thin shapes tunnelling and jittering At least 0.
collision_mask flags [] The layers it collides with; empty means every layer One of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32.
collision_test enum both Whether a pair is tested when both colliders' layers accept the other, or when either does; two colliders that differ use both One of both, either.
contact_force_threshold float 0 How hard a contact must be before on_contact_force is called At least 0.
contact_pairs flags ["dynamic_dynamic","dynamic_kinematic","dynamic_static"] Which pairs of body kinds this collider is tested against; a sensor watching kinematic platforms needs more than the default One of dynamic_dynamic, dynamic_kinematic, dynamic_static, kinematic_kinematic, kinematic_static, static_static.
density float 1 Mass per volume, so the shape's size sets its mass; 0 makes a collider that adds no mass to its body At least 0.
edge_radius float 0 Rounds each shaped tile's polygon by this radius; full cells have no border to round At least 0.
enabled bool true Collide at all; a disabled collider keeps its shape and costs nothing
events flags [] What this collider reports to its node's script: on_collision_enter and on_collision_exit, or on_contact_force One of collision, contact_force.
fit enum convex_hull What a shaped tile's polygon becomes: its hull, its box, its oriented box, or convex pieces that keep a concave outline One of convex_hull, aabb, obb, convex_decomposition.
friction float 0.5 Surface friction; 0 is ice At least 0.
friction_combine enum average How this surface's friction combines with the other one's One of average, min, multiply, max, clamped_sum, geometric_mean.
inertia float 0 The whole map's resistance to spin about center_of_mass, shared over its colliders by area; 0 takes the shapes' own about that centre At least 0.
mass float 0 Mass in kilograms, overriding what density works out to; 0 keeps the density At least 0.
one_way bool false A platform bodies land on from the side one_way_axis names and pass through from the other
one_way_angle float 0.1 How far a contact's normal may lean from one_way_axis and still hold the body; radians in the file Range 0–180.
one_way_axis vec2 [0,1] The side a one-way cell holds bodies on, in the map's axes: [0, 1] lands them from above and lets them up through from below. A flipped or turned shaped tile turns it with its polygon
restitution float 0 Bounciness: 0 is a dead stop, 1 a full rebound, and above 1 each bounce gains energy At least 0.
restitution_combine enum average How this surface's bounciness combines with the other one's One of average, min, multiply, max, clamped_sum, geometric_mean.
sensor bool false Detects overlaps without colliding: bodies pass through and are reported
solver_layer flags ["1"] Layers for the solver alone: a pair can be detected but not resolved One of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32.
solver_mask flags [] Which solver layers this one pushes against; empty means all of them One of 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32.
solver_test enum both The same choice for the solver layers One of both, either.
surface_velocity vec2 [0,0] How fast every cell's surface slides along itself, in the map's axes: a conveyor belt carries what rests on it