Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Collision Presets

An asset by AdrienLucas
The page banner background of a mountain and forest
Collision Presets thumbnail image
Collision Presets thumbnail image
Collision Presets hero image

Quick Information

0 ratings
Collision Presets icon image
AdrienLucas
Collision Presets

Godot already provides 32 collision layers, but managing them across large projects quickly becomes error-prone.A simple editor plugin for Godot 4 that turns manual collision layer and mask setup into reusable named presets. Instead of remembering bitmask integers or ticking boxes on every physics object, you define named presets (like “Player”, “Enemy”, “Trigger”) once and apply them with a single click in the editor. The plugin also generates safe constants for use in code and keeps assigned presets in sync at runtime.The plugin features:- A clean preset UI integrated into the CollisionObject inspector.- Central preset database stored in a resource, ready for version control.- Automatically generated CollisionPresets constants for autocomplete.- Runtime sync via an autoload so presets are applied when the scene runs.- Metadata-based storage so scene inheritance and version control work naturally.Lookup the GitHub readme for examples and documentation.https://github.com/Adrien-Lucas/godot-collision-presetsWorks with both 2D and 3D physics objects.

Supported Engine Version
4.5
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
1 day ago
Git URL
Issue URL

Godot Collision Presets

collision_presets_logo

Turn messy fiddling with collision layers and masks into presets that you can easily apply to your nodes.

Overview

Godot already provides 32 collision layers, but managing them across large projects quickly becomes error-prone.

Collision Presets is a Godot 4 editor plugin designed to simplify physics management in 2D or 3D projects. Instead of manually memorizing bitmask integers or ticking boxes for every CollisionObject3D, you can define named presets (e.g., "Player", "Enemy", "Trigger") and apply them with a single click. The plugin keeps layers and masks in sync at runtime and exposes a small, clean API for code usage.

BEFORE AFTER
README godot windows editor dev x86_64_n4lsLj8fD1 README godot windows editor dev x86_64_DiAuice1ji-00 00 00 000-00 00 08 701

Minimal Examples

Once a preset is defined in the editor, you can apply it in your scripts using the generated constants:

# Setting a node's preset is supported in @tool mode. Uncomment to try it out!
# @tool
extends CharacterBody3D

func _ready():
    # Automatically apply the "Player" preset
    CollisionPresetsAPI.set_node_preset(self, CollisionPresets.Player)

Or check a preset's mask value for raycasting:

var query := PhysicsRayQueryParameters3D.create(from, to)

var collision_preset_list = [CollisionPresets.WorldStatic, CollisionPresets.Player]
for preset_name in collision_preset_list:
    var preset_layer = CollisionPresetsAPI.get_preset_layer(preset_name)
    query.collision_mask |= preset_layer # Combine multiple layer bitmasks
var result := space_state.intersect_ray(query)

Features

  • Inspector Integration: A custom UI appears directly in the CollisionObject inspector.
  • Default Collision Preset: Define a project-wide default preset automatically applied to any CollisionObject without a preset.
  • Metadata Based: The selected preset is stored in the node’s metadata. This makes it source control friendly and fully compatible with scene inheritance.
  • Centralized Database: All collision presets are saved automatically in a single .tres resource.
  • Type-Safe Constants: Automatically generates a CollisionPresets class with constants for all your preset names, enabling autocomplete and preventing typos.
  • Runtime Sync: An autoload ensures that any node with a preset assigned in the editor gets the correct layer and mask values when the game starts.
  • ID-Based Robustness: Presets use unique IDs internally, so renaming a preset won't break your existing node assignments.

Short Documentation

API Reference (CollisionPresetsAPI)

  • get_preset_layer(name) / get_preset_mask(name): Retrieves the raw integer values for a specific preset.
  • set_node_preset(node, preset_name): Sets a preset and updates the node's metadata (safe for @tool scripts).
  • get_node_preset(node): Returns the name of the preset currently assigned to a node.

Generated Constants (CollisionPresets)

The plugin generates a script at res://addons/collision_presets/preset_names.gd containing:

  • CollisionPresets.YOUR_PRESET_NAME: A string constant for each preset.
  • CollisionPresets.all(): Returns a PackedStringArray of all available preset names.

Installation

  1. Download or clone this repository into your project's addons/ folder.
  2. Go to Project Settings > Plugins and enable Collision Presets.
  3. The plugin will automatically:
    • Create a presets.tres file in the plugin folder.
    • Register a CollisionPresetRuntime autoload.
    • Generate the CollisionPresets constants script.
  4. Select any CollisionObject (StaticBody, CharacterBody, etc.) and look for the Preset dropdown in the Inspector.

AI Disclaimer

This plugin was mainly vibe-coded using Junie by JetBrain. It was then cleaned and refined by hand to reach release quality.

Godot already provides 32 collision layers, but managing them across large projects quickly becomes error-prone.

A simple editor plugin for Godot 4 that turns manual collision layer and mask setup into reusable named presets.
Instead of remembering bitmask integers or ticking boxes on every physics object, you define named presets (like “Player”, “Enemy”, “Trigger”) once and apply them with a single click in the editor. The plugin also generates safe constants for use in code and keeps assigned presets in sync at runtime.

The plugin features:
- A clean preset UI integrated into the CollisionObject inspector.
- Central preset database stored in a resource, ready for version control.
- Automatically generated CollisionPresets constants for autocomplete.
- Runtime sync via an autoload so presets are applied when the scene runs.
- Metadata-based storage so scene inheritance and version control work naturally.

Lookup the GitHub readme for examples and documentation.
https://github.com/Adrien-Lucas/godot-collision-presets

Works with both 2D and 3D physics objects.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Collision Presets icon image
AdrienLucas
Collision Presets

Godot already provides 32 collision layers, but managing them across large projects quickly becomes error-prone.A simple editor plugin for Godot 4 that turns manual collision layer and mask setup into reusable named presets. Instead of remembering bitmask integers or ticking boxes on every physics object, you define named presets (like “Player”, “Enemy”, “Trigger”) once and apply them with a single click in the editor. The plugin also generates safe constants for use in code and keeps assigned presets in sync at runtime.The plugin features:- A clean preset UI integrated into the CollisionObject inspector.- Central preset database stored in a resource, ready for version control.- Automatically generated CollisionPresets constants for autocomplete.- Runtime sync via an autoload so presets are applied when the scene runs.- Metadata-based storage so scene inheritance and version control work naturally.Lookup the GitHub readme for examples and documentation.https://github.com/Adrien-Lucas/godot-collision-presetsWorks with both 2D and 3D physics objects.

Supported Engine Version
4.5
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
1 day ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers