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.
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
_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