Chris' Tutorials
Docs/Grid Placement

Class

PlacementPositioning2DUtils

Generated GDScript class reference for GridPlacement.PlacementPositioning2DUtils.

StatusDraft
Versionv6.0
UpdatedDevelopment docs generated from GDScript source

This is unreleased documentation in active development. APIs, class names, and behavior may change before the final release.

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 RefCounted

Members

NameKindSummary
get_tile_from_global_positionMethod
map_positionProperty
move_to_tile_centerMethod
tile_center_localProperty
tile_center_globalProperty
move_to_closest_valid_tile_centerMethod
used_rectProperty
resolved_tileProperty
limit_tile_to_max_distanceMethod
effective_regionProperty
snapped_targetProperty
max_stepsProperty
astar_resultProperty
is_region_validMethod
snap_tile_to_regionMethod
min_xProperty
max_xProperty
min_yProperty
max_yProperty
snappedProperty
get_tile_from_node_positionMethod
localProperty
source_tileProperty
pathProperty
indexProperty
waypointProperty
tileProperty
currentProperty
stepsProperty
stepProperty
dxProperty
dyProperty
step_xProperty
step_yProperty
move_node_by_tilesMethod
current_tileProperty
new_tileProperty
convert_screen_to_world_positionMethod
cameraProperty
canvas_transformProperty
world_posProperty
viewport_center_to_world_positionMethod
center_viewportProperty
move_node_to_tile_at_viewport_centerMethod
world_positionProperty
tileProperty
direction_to_tile_deltaMethod
nProperty
sxProperty
syProperty

Source

addons/grid_placement/utils/placement_positioning_2d_utils.gd

Plugin docs root:gdscript/plugins/grid_placement_dev/docs