Geometry & collision math utilities for the grid building addon. Provides compact, well-documented helper functions used across the addon for tile/polygon overlap and collision tasks. Main responsibilities include:
- Computing polygon vs polygon intersection areas (uses Godot Geometry2D).
- Producing tile polygons for square and isometric tiles and testing polygon overlaps against tiles (area-based and optimized native collision checks).
- Converting various Shape2D types to polygon approximations for geometry processing (Rectangle, Circle, Capsule, ConvexPolygon, fallback to rect).
- Utility helpers: axis-aligned rectangle detection and polygon bounding rect. Note: Tile shape enforcement: All functions use TileSet.TileShape enum values.[br] Use: TileSet.TILE_SHAPE_SQUARE, TileSet.TILE_SHAPE_ISOMETRIC, TileSet.TILE_SHAPE_HALF_OFFSET_SQUARE [br] Avoid using raw integers (0, 1, 2) or strings ("square", "isometric", etc.)
Source: addons/grid_placement/utils/placement_geometry_math.gd
Syntax
class PlacementGeometryMathMembers
| Name | Kind | Summary |
|---|---|---|
polygon_intersection_area | Method | |
get_tile_polygon | Method | |
intersection_area_with_tile | Method | |
does_polygon_overlap_tile | Method | |
does_shape_overlap_tile_optimized | Method | |
does_polygon_overlap_tile_optimized | Method | |
get_polygon_bounds | Method | |
convert_shape_to_polygon | Method | |
intersection_polygon_area | Method | |
is_exact_polygon_match | Method | |
exact_polygon_area | Method | |
isometric_floating_point_fallback | Method | |
close | Property | |
square_bounding_box_fallback | Method | |
min_tile | Property | |
max_tile | Property | |
tile_rect | Property | |
min_poly | Property | |
max_poly | Property | |
poly_rect | Property | |
intersection_rect | Property | |
intersection_area | Property | |
overlap_x | Property | |
overlap_y | Property |