Skip to content

IndicatorCollisionTestSetup

IndicatorCollisionTestSetup

Builds collision test parameters for a CollisionObject2D to enable placement indicators to perform accurate collision checks against object geometry.

Purpose: Converts CollisionObject2D shapes into testable RectCollisionTestingSetup instances for collision validation during placement operations.

Key Features: • Creates one RectCollisionTestingSetup per shape owner • Expands test areas using configurable shape_stretch_size • Supports CollisionShape2D and CollisionPolygon2D nodes • Comprehensive error reporting via issues array

Quick Start:

var test_setup = IndicatorCollisionTestSetup.new(collision_object, Vector2(16, 16))
if test_setup.validate_setup():
# Use test_setup.rect_collision_test_setups for collision testing
pass

Advanced Documentation: For detailed usage, API reference, and troubleshooting, see: https://gridbuilding.pages.dev/api/v5.0.0/IndicatorCollisionTestSetup

Dependencies: RectCollisionTestingSetup, GBGeometryUtils

collision_object: CollisionObject2D :

The CollisionObject2D being analyzed for collision testing.

shape_stretch_size: Vector2

Size to stretch collision shapes for comprehensive tile coverage. Recommended: Use your tile size (e.g., Vector2(16, 16) for 16x16 tiles). See advanced documentation for detailed sizing guidance.

rect_collision_test_setups: Array[RectCollisionTestingSetup]

Array of RectCollisionTestingSetup instances, one per shape owner. Use these setups to perform collision tests for placement indicators.

issues: Array[String] = []

Issues discovered during collision test setup. Check this array after initialization to identify configuration problems.

add_issue( p_issue: String ) -> void

Records an issue encountered during setup.

free_testing_nodes( ) -> void

Frees all testing nodes created during setup. Call this when the setup is no longer needed to prevent memory leaks.

validate_setup( ) -> bool

Validates the collision test setup and reports any issues. Returns true if setup is valid and ready for use, false otherwise.

addons/grid_building/placement/rule_check_indicator/indicator_collision_test_setup.gd


This page was auto-generated from GDScript source. Edit the source file to improve documentation.

Generated on 2025-09-07