Navigation and Collision

Walkable rects, generated walls, NavigationRegion2D bake, agent steering.

stablegodotnpcarchitecture
On this page
Hotel overview with walkable areas, walls, room bounds, and stations drawn
Debug overlay: green walkable rects, yellow wall/furniture colliders, blue Room camera bounds, pink station markers.

Idea

Full hotel map without debug overlay
Same continuous world without overlays — bar, hallway, lobby, stairwells, upper floors.

Author walkable and obstacle rectangles in world units. On _ready, hotel_layout.gd:

  1. Emits StaticBody2D wall segments on every walkable edge whose outside is non-walkable (doorways open automatically).
  2. Bakes a NavigationPolygon via NavigationServer2D.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.