godot-navigation-pathfinding
Installation
SKILL.md
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. UseNavigationServer.bake_from_source_geometry_data_async()for stutter-free updates. - 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. - NEVER use heavy node-based navigation for thousands of simple entities — Use
NavigationServer3D/2DRIDs directly to bypass node overhead. - NEVER call
get_path()every frame — Usequery_path()with reusedNavigationPathQueryResultobjects to prevent massive heap allocation and GC pressure. - NEVER leave 'enter_cost' at 0 for high-penalty areas — Use costs to make AI prefer logical paths (roads over water) instead of just shortest geometric distance.
- NEVER ignore
agent_set_avoidance_callback— Always use the callback for safe velocity computation to avoid synchronization issues and "jittery" movement.
Decision Tree → Scripts
MANDATORY for the chosen path. Do NOT Load editor-intro / Official Docs bootstrap recipes from this skill body (use Reference links when you need first-time region setup).