Godot navigation pathfinding

From thedivergentai/GD-Agentic-Skills · View interactive version

Godot navigation pathfinding is an AI agent skill from the GitHub repository thedivergentai/GD-Agentic-Skills. Expert blueprint for AI pathfinding (tower defense, RTS, stealth) using NavigationAgent2D/3D, NavigationServer, avoidance, and dynamic navigation mesh generation. Use when implementing enemy AI, NPC movement, or obstacle avoidance. Keywords NavigationAgent2D, NavigationRegion2D, pathfinding, Navigat

How to use this skill

Skill file

NEVER Do in Navigation & Pathfinding

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).

| Need | Script |

|------|--------|

| Runtime / procedural bake without hitch | MANDATORY async_dynamic_baking.gd |

| Agent stuck / jitter recovery | MANDATORY agent_stuck_detection.gd |

| High-count RVO without nodes | MANDATORY low_level_avoidance.gd |

| Moving platforms / dynamic regions | dynamic_nav_manager.gd |

| RID-only maps/regions | server_navigation_setup.gd |

| Reused path query objects | memory_optimized_queries.gd |

| Terrain enter/travel costs | terrain_cost_manager.gd |

| Projectiles as RVO obstacles | moving_obstacle_server.gd |

| Links (jump/teleport/elevator) | nav_link_traversal.gd |

| Walk / fly / swim layers | layer_mask_navigation.gd |

| Crowd formation offsets | group_avoidance_formations.gd |

| Server RVO crowd agent (node-less) | crowd_agent_3d.gd |

| Dynamic navmesh carve (impact holes) | nav_mesh_carver_3d.gd |

| Bake-time benchmark | navmesh_profiler.gd |

| Smart agent wrapper | smart_navigation_agent.gd |

Chase / Retarget Rule (never contradict NEVER)

Do not assign target_position every physics frame. Retarget on a timer (~0.2s) or when the chased body moves beyond a distance threshold:

# Threshold retarget — not per-frame path spam
const RETARGET_DIST := 1.5
var _last_target: Vector3

func _physics_process(_delta: float) -> void:
    var desired := prey.global_position
    if desired.distance_to(_last_target) >= RETARGET_DIST:
        nav_agent.target_position = desired
        _last_target = desired
    if nav_agent.is_navigation_finished():
        return
    var next := nav_agent.get_next_path_position()
    velocity = (next - global_position).normalized() * speed
    move_and_slide()

Available Scripts

[async_dynamic_baking.gd](scripts/async_dynamic_baking.gd)

bake_from_source_geometry_data_async — parse on main, bake off-thread.

[agent_stuck_detection.gd](scripts/agent_stuck_detection.gd)

Distance-over-time stall detection and recovery.

[low_level_avoidance.gd](scripts/low_level_avoidance.gd)

Server-side RVO agents + avoidance callbacks.

[dynamic_nav_manager.gd](scripts/dynamic_nav_manager.gd)

Runtime navmesh updates for moving platforms.

[server_navigation_setup.gd](scripts/server_navigation_setup.gd)

Node-less maps/regions via NavigationServer RIDs.

[memory_optimized_queries.gd](scripts/memory_optimized_queries.gd)

Reuse path query parameter/result objects.

[terrain_cost_manager.gd](scripts/terrain_cost_manager.gd)

enter_cost / travel_cost for preferred routes.

[moving_obstacle_server.gd](scripts/moving_obstacle_server.gd)

Dynamic RVO obstacles without full rebake.

[nav_link_traversal.gd](scripts/nav_link_traversal.gd)

NavigationLink jump/teleport/elevator handling.

[layer_mask_navigation.gd](scripts/layer_mask_navigation.gd)

Multi-domain navigation layers (walk/fly/swim).

[group_avoidance_formations.gd](scripts/group_avoidance_formations.gd)

Leader-relative offsets to reduce clumping.

[smart_navigation_agent.gd](scripts/smart_navigation_agent.gd)

Production NavigationAgent wrapper patterns.

Expert Pointers

Deep dives (on demand)

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API;

load Related Skills when routing work to a peer domain — do not preload the whole lattice.

Official Documentation

Related Skills

Prerequisites
Complements
Downstream / consumers
Master
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.