CollisionTestSetup2D
Expands the rectangle by shape_stretch_size...
Expands the rectangle by shape_stretch_size to ensure comprehensive tile coverage. Handles complex transforms by converting to squares when rotation/skew is present.
Version: v5.0.0
Inherits: RefCounted
Source: collision_test_setup_2d.gd
Parsing: AST-based for maximum accuracy with symbol typing
Variables
collision_object:
The CollisionObject2D being analyzed for collision testing.
shape_stretch_size:
See advanced documentation for detailed sizing guidance.
rect_collision_test_setups:
Use these setups to perform collision tests for placement indicators.
issues:
Check this array after initialization to identify configuration problems.
Methods
_init
Signature: _init(p_collision_object: CollisionObject2D, p_shape_stretch_size: Vector2) -> void
Initializes collision test setup for the given CollisionObject2D.
Returns: void
Parameters:
p_collision_object: CollisionObject2Dp_shape_stretch_size: Vector2
add_issue
Signature: add_issue(p_issue: String) -> void
Records an issue encountered during setup.
Returns: void
Parameters:
p_issue: String
free_testing_nodes
Signature: free_testing_nodes() -> void
Call this when the setup is no longer needed to prevent memory leaks.
Returns: void
validate_setup
Signature: validate_setup() -> bool
Returns true if setup is valid and ready for use, false otherwise.
Returns: bool
_create_rect_tests_for_collision_object
Signature: _create_rect_tests_for_collision_object(p_collision_object : CollisionObject2D: Variant) -> Array
Creates RectCollisionTestingSetup instances for each shape owner in the CollisionObject2D.
Returns: Array
Parameters:
p_collision_object : CollisionObject2D: Variant
_get_testing_rect_for_owner
Signature: _get_testing_rect_for_owner(p_shape_owner: Node2D) -> Rect2
Supports CollisionShape2D and CollisionPolygon2D nodes.
Returns: Rect2
Parameters:
p_shape_owner: Node2D
_adjust_rect_to_testing_size
Signature: _adjust_rect_to_testing_size(p_base_rect: Rect2, p_shape_owner_global_transform: Transform2D) -> Rect2
Handles complex transforms by converting to squares when rotation/skew is present.
Returns: Rect2
Parameters:
p_base_rect: Rect2p_shape_owner_global_transform: Transform2D