setup-collision-layers
Skill2 starsChanged 6 months agoMITView on GitHub
Configure Godot 4.x physics collision layers and masks for 2D and 3D — sensible 11-layer scheme for player, enemies, environment, projectiles, pickups, triggers, hurtboxes, hitboxes. Edits project.godot.
In this repository33 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- bootstrap-godot-projectSkill
- codebase-surveySkill
- create-autoloadSkill
- create-componentSkill
- create-resourceSkill
- create-sceneSkill
- create-state-machineSkill
- export-configSkill
- feature-planSkill
- feature-specSkill
- game-brainstormingSkill
- gdd-writerSkill
- genre-pack-3d-actionSkill
- genre-pack-platformerSkill
- genre-pack-topdownSkill
- genre-pack-turnbasedSkill
- godot-patternsSkill
- gut-test-writerSkill
- networking-foundationSkill
- performance-auditSkill
- save-schema-migrationSkill
- setup-git-godotSkill
- setup-input-mapSkill
- setup-localizationSkill
- setup-save-systemSkill
- sfx-generatorSkill
- shader-writerSkill
- subagent-dev-modeSkill
- ui-patterns-godotSkill
- update-docsSkill
- using-godot-superpowersSkill
- writing-game-planSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 106
If hits don't register:
- Very specific: line 107
Verify both shapes have monitoring = true (Areas) or appropriate physics setup
- Distinctive: line 109
Check shapes overlap visually (debug drawing on)
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Setup Collision Layers
Configures Project Settings → Layer Names → 2D Physics and 3D Physics with a battle-tested 11-layer scheme that supports clean hurtbox/hitbox separation.
The scheme
| Bit | Name | Used by | Masks (collides with) |
| 1 | World | StaticBody2D/3D, TileMapLayer, terrain | (passive — bodies on this layer don't actively scan) |
| 2 | Player | CharacterBody2D/3D player | World, Enemy, Pickup, Trigger |
| 3 | Enemy | Enemy CharacterBody / RigidBody | World, Player, EnemyHurtbox |
| 4 | PlayerProjectile | Bullets / abilities owned by player | World, Enemy, EnemyHurtbox |
| 5 | EnemyProjectile | Bullets / abilities owned by enemies | World, Player, PlayerHurtbox |
| 6 | Pickup | Coins, items, powerups | Player |
| 7 | Trigger | Area-based events, doors, checkpoints | Player (also Enemy if needed) |
| 8 | PlayerHurtbox | Area on player that takes damage | EnemyHitbox, EnemyProjectile |
| 9 | PlayerHitbox | Area on player that deals damage | EnemyHurtbox |
| 10 | EnemyHurtbox | Area on enemy that takes damage | PlayerHitbox, PlayerProjectile |
| 11 | EnemyHitbox | Area on enemy that deals damage | PlayerHurtbox |
Hitbox rule: a hitbox sits on its own layer and masks the opposing hurtbox layer. Never the reverse.
Apply to project.godot
Append (or merge into existing [layer_names] section):
[layer_names]
2d_physics/layer_1="World"
2d_physics/layer_2="Player"
2d_physics/layer_3="Enemy"
2d_physics/layer_4="PlayerProjectile"
2d_physics/layer_5="EnemyProjectile"
2d_physics/layer_6="Pickup"
2d_physics/layer_7="Trigger"
2d_physics/layer_8="PlayerHurtbox"
2d_physics/layer_9="PlayerHitbox"
2d_physics/layer_10="EnemyHurtbox"
2d_physics/layer_11="EnemyHitbox"
3d_physics/layer_1="World"
3d_physics/layer_2="Player"
3d_physics/layer_3="Enemy"
3d_physics/layer_4="PlayerProjectile"
3d_physics/layer_5="EnemyProjectile"
3d_physics/layer_6="Pickup"
3d_physics/layer_7="Trigger"
3d_physics/layer_8="PlayerHurtbox"
3d_physics/layer_9="PlayerHitbox"
3d_physics/layer_10="EnemyHurtbox"
3d_physics/layer_11="EnemyHitbox"Helper constants (optional but recommended)
Add scripts/collision_layers.gd:
class_name CollisionLayers
extends RefCounted
## Bit constants for layer set/get via code. Use as flags:
## hitbox.collision_layer = CollisionLayers.PLAYER_HITBOX
## hitbox.collision_mask = CollisionLayers.ENEMY_HURTBOX
const WORLD := 1 << 0
const PLAYER := 1 << 1
const ENEMY := 1 << 2
const PLAYER_PROJECTILE := 1 << 3
const ENEMY_PROJECTILE := 1 << 4
const PICKUP := 1 << 5
const TRIGGER := 1 << 6
const PLAYER_HURTBOX := 1 << 7
const PLAYER_HITBOX := 1 << 8
const ENEMY_HURTBOX := 1 << 9
const ENEMY_HITBOX := 1 << 10Configuration cheatsheet for common nodes
| Node | collision_layer | collision_mask |
| Player CharacterBody | Player | World, Enemy, Pickup, Trigger |
| Enemy CharacterBody | Enemy | World, Player |
| Wall / floor StaticBody | World | (none) |
| Player bullet | PlayerProjectile | World, Enemy, EnemyHurtbox |
| Enemy bullet | EnemyProjectile | World, Player, PlayerHurtbox |
| Coin Area | Pickup | (none — Player's mask handles it) |
| Door trigger Area | Trigger | (none) |
| Player Hurtbox Area | PlayerHurtbox | EnemyHitbox, EnemyProjectile |
| Player Hitbox Area (sword) | PlayerHitbox | EnemyHurtbox |
| Enemy Hurtbox Area | EnemyHurtbox | PlayerHitbox, PlayerProjectile |
| Enemy Hitbox Area (claw) | EnemyHitbox | PlayerHurtbox |
Debugging
Enable Debug → Visible Collision Shapes while running. Color collisions to verify layer / mask combinations are correct.
If hits don't register:
- Verify both shapes have
monitoring = true(Areas) or appropriate physics setup - Confirm layer/mask: emitter on its own layer, mask = receiver's layer
- Check shapes overlap visually (debug drawing on)
- For Areas: check
monitorable = trueon the receiver
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

