navigation-pathfinding
Installation
SKILL.md
Navigation & Pathfinding
NavigationServer-powered pathfinding with avoidance and dynamic obstacles define robust AI movement.
Available Scripts
dynamic_nav_manager.gd
Expert runtime navigation mesh updates for moving platforms.
NEVER Do in Navigation & Pathfinding
- NEVER set
target_positionbefore awaiting physics frame — NavigationServer not ready in_ready()? Path fails silently. MUSTcall_deferred()thenawait get_tree().physics_frame. - NEVER use
NavigationRegion2D.bake_navigation_polygon()at runtime — Synchronous baking freezes game for 100+ ms. UseNavigationServer2Dfor dynamic updates OR pre-bake. - NEVER forget to check
is_navigation_finished()— Callingget_next_path_position()after reaching target = stale path, AI walks to old position. - NEVER use
avoidance_enabledwithout setting radius — Default radius = 0, agent passes through others. Setnav_agent.radius = collision_shape.radiusfor proper avoidance. - NEVER poll
target_positionevery frame for chase AI — Setting target 60x/sec = path recalculation spam. Use timer (0.2s intervals) or distance threshold for updates. - NEVER assume path exists — Target unreachable (blocked by walls)?
get_next_path_position()returns invalid. Checkis_target_reachable()or validate path length.