Overview
GridManager converts between world positions and TileCoord values. It also decides whether a tile can be walked on and whether movement from one tile to another is valid.
Most movement and pathfinding rules eventually pass through GridManager, so it should exist once in any scene using Tile Tick Movement.
Inspector Settings
Tile Size
Size of one tile in world units.
Grid Origin
World position used as the origin of the tile grid.
Ground Mask
Layers used when sampling ground height at tile centers.
Blocked Mask
Layers treated as blocked for obstacle checks and wall linecasts.
Walkability Check Radius / Height
Capsule size used when checking if a tile overlaps blocked colliders.
Wall Check Height
Height above the tile center used for linecasts between adjacent tiles.
Max Walkable Slope
Maximum ground slope angle a unit can traverse.
Max Step Height Between Adjacent Tiles
Maximum height difference allowed between neighboring tiles.
Public API
WorldToTile(Vector3 worldPosition)Converts a world position into a TileCoord.
TileToFlatWorldCenter(TileCoord tile)Returns the flat world center of a tile without terrain height sampling.
TryGetGroundedWorldCenter(TileCoord tile, out Vector3 groundedCenter)Samples the ground height at a tile center.
IsWalkable(TileCoord tile)Returns true if the tile has ground, acceptable slope, and no blocked overlap.
CanTraverse(TileCoord from, TileCoord to)Validates movement between adjacent tiles, including walkability, step height, walls, and diagonal corner cutting.
TryGetTileFromScreenPoint(...)Raycasts from a screen point and returns the tile under the hit point. Useful for click-to-move controls.
Runtime Properties
| TileSize | Configured tile size. |
|---|---|
| GridOrigin | World-space origin of the grid. |
| BlockedMask | Layer mask used for blocked checks. |
| MaxWalkableSlope | Current slope limit. |
Common Usage
TileCoord tile = GridManager.Instance.WorldToTile(worldPosition);
if (GridManager.Instance.IsWalkable(tile))
{
movementMotor.TryMoveTo(tile);
}