CollisionTestSetup
AUTO-GENERATED FILE – DO NOT EDIT MANUALLY
CollisionTestSetup
Source File: addons/grid_building/placement/collsion_test/collision_test_setup.gd
Extends: RefCounted
Properties
Property:
collision_object: CollisionObject2D :- The CollisionObject2D being analyzed for collision testing.Property:
owning_node: Node2DThe owning Node2D that contains this collision object (e.g., the test object or scene node). This provides context about which object this collision setup belongs to.
Property:
shape_stretch_size: Vector2Size 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.
Property:
rect_collision_test_setups: Array[RectCollisionTestingSetup]Array of RectCollisionTestingSetup instances, one per shape owner. Use these setups to perform collision tests for placement indicators.
Property:
issues: Array[String] = []Issues discovered during collision test setup. Check this array after initialization to identify configuration problems.
Public Methods
add_issue
Records an issue encountered during setup.
free_testing_nodes
Frees all testing nodes created during setup. Call this when the setup is no longer needed to prevent memory leaks.
validate_setup
Validates the collision test setup and reports any issues. Returns true if setup is valid and ready for use, false otherwise.
Private Methods
_init
Flags: private
Initializes collision test setup for the given CollisionObject2D.
_create_rect_tests_for_collision_object
Flags: private
Creates RectCollisionTestingSetup instances for each shape owner in the CollisionObject2D.
_get_testing_rect_for_owner
Flags: private
Calculates the testing rectangle for a shape owner node. Supports CollisionShape2D and CollisionPolygon2D nodes.
_adjust_rect_to_testing_size
Flags: private
Expands the rectangle by shape_stretch_size to ensure comprehensive tile coverage. Handles complex transforms by converting to squares when rotation/skew is present.