Draft — Unreleased:This page is in active development. APIs, class names, and behavior may change before the release is finalized. Use it as a preview of what's coming — not as a stable integration target.
Pure, stateless helpers used by the placement/collision mapping pipeline. These functions are extracted from the runtime mapper to allow focused unit tests and reuse from multiple contexts without side-effects. [b]Default Overlap Thresholds[/b]
- Edge epsilon: [code]0.01[/code] (1% tolerance for edge detection)
- Minimum area fraction: [code]0.05[/code] (5% of tile area required for overlap)
- Very small polygons (< 5% of tile area) are filtered out to avoid spurious detections
- For 16×16 tiles, minimum overlap area is 12.8 square units
- For 32×32 tiles, minimum overlap area is 51.2 square units [b]Testing Notes[/b]
- Micro polygons smaller than 5% threshold return zero tiles (by design)
- Use larger polygons (≥25% tile area) for reliable collision detection in tests
- Production mapper may use different thresholds for specific shape types [i]Documentation style[/i]: Comments use BBCode to render nicely in the Godot editor's help panel. Cross‑references
- Center‑based tile semantics: Indicator and mapper math assume tile centers; e.g., 16×16 → center offset (+8,+8).
- Iteration range epsilon: compute_tile_iteration_range applies symmetric epsilons to min/max to avoid fencepost tiles when world bounds align exactly to tile borders (bottom‑inclusive, top‑exclusive in practice).
Source: addons/grid_placement/utils/collision_geometry_utils.gd
Syntax
class CollisionGeometryUtils extends RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
build_shape_transform | Method | |
shape_transform | Property | |
shape_local_offset | Property | |
to_world_polygon | Method | |
world_points | Property | |
global_xform | Property | |
compute_tile_iteration_range | Method | |
result | Property | |
epsilon | Property | |
adjusted_min_corner | Property | |
start_tile | Property | |
adjusted_max_corner | Property | |
end_tile_inclusive | Property | |
end_exclusive | Property | |
center_tile_for_polygon_positioner | Method | |
center_tile_for_shape_object | Method | |
compute_polygon_tile_offsets | Method | |
offsets | Property | |
overlapped_tiles | Property | |
is_polygon_convex | Method | |
n | Property | |
sign | Property | |
a | Property | |
b | Property | |
c | Property | |
cross | Property | |
curr_sign | Property |
Source
addons/grid_placement/utils/collision_geometry_utils.gd
Plugin docs root:gdscript/plugins/grid_placement_dev/docs