Navigation and Collision
Walkable rects, generated walls, NavigationRegion2D bake, agent steering.
On this page
Room camera bounds, pink station markers.Idea
Author walkable and obstacle rectangles in world units. On _ready, hotel_layout.gd:
- Emits
StaticBody2Dwall segments on every walkable edge whose outside is non-walkable (doorways open automatically). - Bakes a
NavigationPolygonviaNavigationServer2D.bake_from_source_geometry_data.
Overlap neighbouring floors/doorways by ~10px — exact edge touch is fragile.
Agent
$NavigationAgent2D.target_position = stand
var next := agent.get_next_path_position()
return global_position.direction_to(next)
Layers
Player hits walls (mask 4). Guests do not collide with walls; the navmesh keeps them inside. Guest-guest collisions form queues.
Verification
Query paths without AI:
NavigationServer2D.map_get_path(map, from, to, true)
See Debugging Godot and project DEVELOPING.md.