Collision layers and masks
2025/12/27
- Type
- Learning Resource
- Format
- Glossary Article
- Version
- General
- Subject Tags
- Created
- Updated
- 2026/02/16
- 2025/12/27
In Godot, collision layers and masks are properties available to all physics nodes that filter which nodes can interact with each other. They are a very efficient way to filter physics interactions performance-wise.
While the two properties are called layers and masks, you can think of them as more of a grouping or tagging system but just for physics. Physics layers control what physics groups a node is part of, and physics masks control what physics groups a node detects.
For example, if you have a player character and a wall, you might want the player to collide with the wall but not with other players.
You can achieve this by setting the player's collision layer to 1 and the collision mask to 2. Then, you can set the wall's collision layer to 2 and give it no collision mask (because the wall itself doesn't need to detect anything; only the player needs to detect the wall and stop when touching it).
This way, the player will detect the wall because the player's collision mask matches the wall's collision layer. The player won't detect other players because its collision mask doesn't match the other players' collision layer.
Under the hood, Godot uses binary operations to handle collision layers and masks. The physics layers and masks are encoded as whole numbers in the computer's memory. The numbers are then compared using binary operations to determine if two nodes should interact with each other. These are very efficient operations that compare the individual 0s and 1s of the binary representation of the numbers, maximizing filtering performance.
This is probably where the term mask comes from, as the binary operations are often called bitmasking operations. The term layer is likely used because it's a common term in 3D modeling and game development to refer to groups of objects.
Don't stop here. Step-by-step tutorials are fun but they only take you so far.
Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.
Get help from peers and pros on GDQuest's Discord server!
20,000 membersJoin ServerThere are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!
Sponsor this library by learning gamedev with us onGDSchool
Learn MoreImprove and build on assets or suggest edits onGithub
Contributeshare this page and talk about GDQUest onRedditYoutubeTwitter…