Grid-aware object rotation utilities for 2D grid-based games. Provides clean, typed helper functions for rotating objects on a grid with proper alignment to grid tiles, particularly for isometric and square tile layouts. Supports configurable rotation increments (90°, 45°, 30°, 60°, or any custom angle). Key features:
- Configurable rotation increments (4-direction, 8-direction, or any custom angle)
- Cardinal direction rotation (backward compatible, convenience API)
- Isometric-aware rotation handling with complex transform support
- Snap-to-grid positioning after rotation
- Integration with existing GridPositioner2D and PlacementPositioning2DUtils
- Static methods for easy testing and reuse Usage Examples:
- 4-direction (RTS-style): rotate_node_clockwise(node, map, 90.0)
- 8-direction (isometric with diagonals): rotate_node_clockwise(node, map, 45.0)
- 6-direction (hex-style): rotate_node_clockwise(node, map, 60.0)
- 12-direction: rotate_node_clockwise(node, map, 30.0) Designed to work seamlessly with the existing Grid Building plugin architecture while providing specialized rotation functionality for grid-based gameplay.
Source: addons/grid_placement/utils/placement_grid_rotation_utils.gd
Syntax
class PlacementGridRotationUtils extends RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
degrees_to_cardinal | Method | |
cardinal_to_degrees | Method | |
rotate_node_clockwise | Method | |
rotate_node_counter_clockwise | Method | |
set_node_direction | Method | |
direction_to_string | Method |
Guides that use this class
Tutorials built on Grid Placement
- Godot multiplayer grid placement: one host, four sessions
- Godot 2D grid building system: paint, place, save
- Godot 3D grid building system: the runtime loop
- Godot 4 grid-building plugins: build mode vs editor tools
- 3D room placement in Godot: build rooms and stack storeys
- 3D grid placement in Godot 4: full setup tutorial
- Snap to a TileMap in Godot: 2D grid placement
- How to make a farming system in Godot
- How to snap objects to a 3D grid in Godot