CollisionTestSetup2D [codeblock] var test_setup = CollisionTestSetup2D.new(collision_object, Vector2(16, 16)) if test_setup.validate_setup(): # Use test_setup.rect_collision_test_setups for collision testing pass [/codeblock] Builds collision test parameters for a CollisionObject2D to enable placement indicators to perform accurate collision checks against object geometry. [b]Purpose:[/b] Converts CollisionObject2D shapes into testable RectCollisionTestingSetup instances for collision validation during placement operations. [b]Key Features:[/b] • 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 [b]Quick Start:[/b] [codeblock] var test_setup = CollisionTestSetup2D.new(collision_object, Vector2(16, 16)) if test_setup.validate_setup(): # Use test_setup.rect_collision_test_setups for collision testing pass [/codeblock] [b]Advanced Documentation:[/b] For detailed usage, API reference, and troubleshooting, see: https://gridbuilding.pages.dev/api/v5.0.0/CollisionTestSetup2D [b]Dependencies:[/b] RectCollisionTestingSetup, PlacementGeometryUtils
Source: addons/grid_placement/placement/collsion_test/collision_test_setup_2d.gd
Syntax
class CollisionTestSetup2D extends RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
collision_object | Property | The CollisionObject2D being analyzed for collision testing. |
shape_stretch_size | Property | 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 | Property | Array of RectCollisionTestingSetup instances, one per shape owner. Use these setups to perform collision tests for placement indicators. |
issues | Property | Issues discovered during collision test setup. Check this array after initialization to identify configuration problems. |
add_issue | Method | |
free_testing_nodes | Method | |
validate_setup | Method | |
no_issues | Property | |
create_test_setups_for_collision_owners | Method | |
setups | Property | |
tile_set | Property | |
collision_shape_stretch_amount | Property | |
create_test_setups_from_test_node | Method | |
shapes_by_owner | Property | |
setups_dict | Property | |
result | Property | |
owner_test_params_set | Property | |
shape_owner_ids | Property | |
shape_owner_node | Property | |
owner_shape_count | Property | |
owned_shapes | Property | |
found_shape | Property | |
owner_testing_rect | Property | |
rect_test_parameters | Property | |
shape | Property | |
shape_rect | Property | |
adjusted_rect | Property | |
polygon | Property | |
polygon_rect | Property | |
adjusted_rect | Property | |
origin | Property | |
adjusted_rect | Property |
Source
addons/grid_placement/placement/collsion_test/collision_test_setup_2d.gd
Plugin docs root:gdscript/plugins/grid_placement_dev/docs