Gridwright Store

29 Nov 2026 · By Gridwright Studio

Godot 4 Tile Collision: Physics Layers, Polygons and One-Way

Gridwright pack artwork for Godot 4 Tile Collision: Physics Layers, Polygons and One-Way

You painted a level in a TileMapLayer, dropped in a CharacterBody2D, pressed play, and the hero fell straight through the floor. Or it stops dead against a wall you never made solid. Or the platform you wanted to jump up through acts like a brick. All three come from the same place: in Godot 4 a tile has no collision until you give its TileSet a physics layer and draw a shape on each tile that should block.

This guide sets that up step by step: the physics layer, the collision polygon on a tile, a one-way platform, and the layer and mask numbers that decide what touches what. Every value and behaviour below was checked in Godot 4.7.2 with a short headless script, so the numbers are what the engine reports, not what a forum thread remembers.

How collision on tiles works in Godot 4

Collision lives in the TileSet resource, not in the map. A TileSet starts with zero physics layers (we read get_physics_layers_count() on a new TileSet: 0). You add a physics layer to the TileSet, and from then on every tile can carry one or more collision polygons for that layer. The map node, TileMapLayer, then builds the physics bodies from those polygons when tiles are placed.

Two details save a lot of guessing. First, a TileMapLayer is a Node2D, not a CollisionObject2D: it has no collision_layer property of its own. The layer and mask numbers come from the TileSet's physics layer. Second, a TileMapLayer has collision_enabled set to true by default, so a map with polygons on its tiles collides without any extra switch.

Step 1: add a physics layer to the TileSet

Select the TileMapLayer, open its TileSet in the inspector, and under Physics Layers press Add Element. In code the same step is ts.add_physics_layer(). Three properties belong to the new layer:

  • Collision Layer: the bits this tile body sits on. Default measured: 1.
  • Collision Mask: the bits it scans for. Default measured: 1.
  • Physics Material: empty by default (null), so friction and bounce are the engine's defaults until you assign one.

A new CharacterBody2D also reports layer 1 and mask 1, so out of the box the player and the tiles see each other. You only change them when you want layers apart, which Step 5 covers.

Step 2: draw a collision polygon on a tile

In the TileSet panel at the bottom, pick the Paint tab, choose the property Physics Layer 0, and draw a polygon on the tile. For a solid block that polygon is the tile's full square. Coordinates are local to the tile's centre, not its top-left corner. For a 16x16 tile the full square is (-8, -8), (8, -8), (8, 8), (-8, 8). We placed such a tile at cell (0, 5), which puts its top edge at y = 80, dropped a CharacterBody2D with a 10x14 box onto it, and the body came to rest at y = 73, exactly 7 pixels above the top edge, which is half the box height.

Platformer Tileset: a 16x16 pixel art side-view level with grass ground, wooden platforms, props and parallax hills
Platformer Tileset: a 16x16 grid where a full-square collision polygon runs from (-8, -8) to (8, 8).

Step 3: make a one-way platform

A one-way platform blocks you when you land on it and lets you through when you jump up from below. In the TileSet this is a flag on the collision polygon, not a separate layer. On the polygon, tick One Way. In code that is set_collision_polygon_one_way(layer, polygon_index, true). Next to it sits a one-way margin, set with set_collision_polygon_one_way_margin(layer, polygon_index, value). We read both defaults on a new polygon: one-way is false and the margin is 1.0.

We tested it with the same falling body and a one-way tile:

  • A solid tile, body dropped from above: lands on it and stands (is_on_floor() true).
  • A one-way tile, body dropped from above: lands on it and stands, ending at the same y.
  • A one-way tile, body launched upward from below: passes through and then lands on top.
  • A solid tile, body launched upward from below: stopped under the tile and never reached the top.

Draw the one-way polygon thin, a strip along the top of the tile rather than the whole square, so only the top surface counts. To drop down through a platform on a key press, nothing in the tile needs to change: move the body down past the strip for a moment, or switch its mask bit off for a few frames. The tile only decides what lands on it.

If you want the art side of platforms (how a platform is drawn so the player reads it as one-way, and how slopes and parallax fit around it), we wrote that up in Platformer Tilesets: Slopes, One-Way Platforms and Parallax. This post is the Godot setup that sits behind it.

Step 4: slopes and the floor angle

A slope tile is a triangle polygon, for example (-8, 8), (8, -8), (8, 8) for a 45 degree rise to the right. Whether the body treats it as a floor or a wall depends on the body, not the tile. CharacterBody2D has floor_max_angle, which we read as 0.7853982 radians, which is 45 degrees. A surface steeper than that counts as a wall. Its up_direction is (0, -1), and motion_mode starts as grounded (0), the right mode for side-view games.

Step 5: layers and masks for tiles, player and enemies

Layers answer the question what am I, and masks answer what do I collide with. Add a second physics layer to the TileSet and set its collision layer to 4 and its mask to 0; Godot returned exactly 4 and 0. A tile on that layer is something bodies can land on, but the tile itself does not scan for anything.

Then the check that matters: we put a solid tile on layer bit 2 only, and dropped a CharacterBody2D whose mask is the default 1. The body fell through the tile and kept falling (end y = 239.99 after 60 physics frames, while the tile top is at y = 80). So if a tile seems not to exist, compare the tile's layer bit with the body's mask before anything else. A typical setup:

  • Layer 1: ground and walls. The player and enemies have it in their mask.
  • Layer 2: one-way platforms. Only the player has it in its mask, so enemies that cannot jump are not carried by it.
  • Layer 3: hazards such as spikes, read by an Area2D, which does not push the player but reports an overlap.
Top-Down Tileset: 16x16 pixel art grass, water, cliffs, fences and props for an RPG map
Top-Down Tileset: cliffs, fences and water that each need a different collision shape.

Top-down maps: what to make solid

A top-down game has no one-way pieces and no slopes, so the work is deciding which parts of a picture block. A good rule is to give collision to what the character cannot step on, and to nothing else: water, cliff walls, fences, stone walls, tree trunks, crates and barrels. Grass, dirt, sand and paths get no polygon at all. In the Top-Down Tileset that is mostly an autotile question: a shore tile needs a polygon covering only its water part, and the same shore shape repeats across the whole set, so draw each shape once and reuse it.

The cliffs matter most. A cliff tile draws a plateau top and a wall below it; only the wall and the plateau edge should block. The walls and roofs guide covers how those pieces overlap and sort in depth. For physics, give the wall face a polygon and leave the plateau top open, so the player walks on the top and is stopped at its edge.

When a tile seems not to collide, first check that the TileSet has a physics layer and that the tile has a polygon on it. A last check costs nothing: turn on Debug > Visible Collision Shapes in the editor, then run the scene. The polygons show in the shape colour from Project Settings (the default we read is a translucent blue), so a missing or misplaced polygon is visible at once.

Where our packs and tool help

Collision is the same job in every game, so the useful part is a tileset whose grid makes it predictable. The Platformer Tileset is a strict 16x16 grid with 47-tile terrain sets for grass, stone, snow and sand, 12 platform pieces, 8 spike pieces, 6 climbing pieces (ladders, vines and chains), and a door that is 16x32. Because every piece sits on the grid, one set of polygons, a full square for ground, a thin top strip for platforms and a small triangle for spikes, transfers across all four terrains. Engine project files are not included in the pack, so the polygons are yours to draw, once.

The Top-Down Tileset has 1,113 tiles and props in 35 sets on the same 16x16 grid: 141 cliff tiles, 32 fence tiles, and water and lava in 4 animation frames. The neighbour bitmask is in every file name and in tiles.json, which tells you which edge of a shore or cliff tile faces the open ground.

If you lay out your levels in Tiled, the Tiled Map to Godot Converter carries tile collision shapes across as polygons on a physics layer and keeps one-way platforms one-way, so you draw collisions once in Tiled and do not repeat Steps 1 to 3 by hand.

For a map in your own style, a custom pack is drawn to your grid and your collision needs.

Commercial use is allowed and the files may not be resold. Packs listed since 2026-10-28 need a credit with a link; the details are in can I use game assets in a commercial game.

Found it useful? Share it

Get the art for your game

Our packs together in the $20 Megabundle, a custom pack drawn for your game, or the packs in this post from $9.99 each.

Best value

Gridwright Megabundle

Our packs and tools on itch.io in one bundle, for less than three of them one by one.

Get it for $20 (opens in a new tab)

Custom packs from $49

Not finding it? We draw it for your game, in 14 days or your money back.

Order a custom pack

Packs mentioned

Related guides