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.
PlacementPositioning2DUtils Static utility functions for 2D grid-based positioning and tile movement operations. This class provides pure functions for common 2D game positioning tasks including:
- Converting between world coordinates, viewport coordinates, and tile coordinates
- Moving nodes to tile centers with proper alignment
- Viewport-to-world coordinate transformations using Camera2D
- Distance-limited movement with adjacency constraints
- Direction vector normalization for tile-based movement All functions are static and depend only on provided parameters, making them highly testable and reusable. Extracted from GridPositioner2D to reduce class coupling and improve maintainability. [b]⭐ CAMERA2D REQUIRED[/b]
- Add a Camera2D node to your scene before using Grid Building operations. World coordinate calculations from mouse position depend on Camera2D for accurate positioning. [b]Requirements:[/b] Designed for 2D games using TileMapLayer and Camera2D nodes.
Source: addons/grid_placement/utils/placement_positioning_2d_utils.gd
Syntax
class PlacementPositioning2DUtils extends RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
get_tile_from_global_position | Method | |
map_position | Property | |
move_to_tile_center | Method | |
tile_center_local | Property | |
tile_center_global | Property | |
move_to_closest_valid_tile_center | Method | |
used_rect | Property | |
resolved_tile | Property | |
limit_tile_to_max_distance | Method | |
effective_region | Property | |
snapped_target | Property | |
max_steps | Property | |
astar_result | Property | |
is_region_valid | Method | |
snap_tile_to_region | Method | |
min_x | Property | |
max_x | Property | |
min_y | Property | |
max_y | Property | |
snapped | Property | |
get_tile_from_node_position | Method | |
local | Property | |
source_tile | Property | |
path | Property | |
index | Property | |
waypoint | Property | |
tile | Property | |
current | Property | |
steps | Property | |
step | Property | |
dx | Property | |
dy | Property | |
step_x | Property | |
step_y | Property | |
move_node_by_tiles | Method | |
current_tile | Property | |
new_tile | Property | |
convert_screen_to_world_position | Method | |
camera | Property | |
canvas_transform | Property | |
world_pos | Property | |
viewport_center_to_world_position | Method | |
center_viewport | Property | |
move_node_to_tile_at_viewport_center | Method | |
world_position | Property | |
tile | Property | |
direction_to_tile_delta | Method | |
n | Property | |
sx | Property | |
sy | Property |
Source
addons/grid_placement/utils/placement_positioning_2d_utils.gd
Plugin docs root:gdscript/plugins/grid_placement_dev/docs