CollisionsCheckRule
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
Rule that validates placement based on collision detection.
Source File: /addons/grid_building/placement/placement_rules/template_rules/collisions_check_rule.gd
Extends: TileCheckRule
Exported Properties
Property:
pass_on_collision = falseControls collision validation behavior:
false: Rule PASSES when no collision (placement requires clear space)true: Rule PASSES when collision detected (placement requires overlap)
Common use cases:
false: Building placement (needs empty space)true: Attachment mechanics (must connect to existing structures)
Property:
messages : [CollisionRuleSettings](./collision-rule-settings/)- Modular message configuration resource
Properties
- Property:
collision_mask = 1- Physics layers to scan for collisions.
Private Properties
- Property:
_rule_check_layer_names : Array[String](private)
Public Methods
setup
| |
Setup the rule with the provided GridTargetingState.
Returns an array of issues found during setup.
p_gts: GridTargetingState - The targeting state to use for placement
[returns] Array[String] - Array of issues found during setup
validate_placement
| |
Validates placement by checking collisions on all provided indicators. Returns a RuleResult with success/failure and messages.
NOTE: When the preview object has no collision shapes, IndicatorSetupUtils generates zero indicators. This method explicitly FAILS in that case because CollisionsCheckRule cannot perform collision tests without indicators. This is the opposite of TileCheckRule behavior, which auto-passes when no indicators exist (nothing to test = pass by design).
get_failing_indicators
| |
Runs the rule against an array of indicators. Returns the number of failing indicators.
p_indicators: Array[RuleCheckIndicator] - Array of indicators to test collision against
NOTE: This method is public and should be used directly by callers. The previous
private wrapper _get_failing_indicators was removed to simplify the API.
get_editor_issues
| |
Returns an array of issues found during editor validation
get_runtime_issues
| |
Returns an array of issues found during runtime validation
Private Methods
_init
| |
Flags: private
_ensure_messages
| |
Flags: private
Ensures messages is initialized. This is critical for web-export
compatibility because _init() is NOT called when Resources are
loaded from .tres files. Any code that accesses messages
must call this first.
_is_in_excluded_bodies
| |
Flags: private
Manual exclusion filter — workaround for Godot’s ShapeCast2D.add_exception() silently failing when the cast origin is outside the excluded body’s bounds.
_indicator_apply_target_exceptions
| |
Flags: private
Add all CollisionObject2D under the preview target as exceptions on the shape cast. Also adds any nodes from GridTargetingState.collision_exclusions (e.g., original object during manipulation move).
_collect_bodies_recursive
| |
Flags: private
Grid Building v5.0.8 | Generated 24/05/2026