NavigationAgent2D
Navigate characters using A* pathfinding with automatic obstacle avoidance.
Pathfinding
No shortcutAdvanced7 min readQuick Reference
NavigationAgent2D
Godot EngineKeyboard Shortcut
N/A
Where to Find
Scene dock — Create New Node > Node2D > NavigationAgent2D
Best Used For
- ▸Navigate AI characters through complex terrain
- ▸Avoid dynamic obstacles and other characters
- ▸Calculate optimal paths using A* algorithm
Advanced⏱ 1–2 hours to master
Key Settings
Set target:Move:
NavigationAgent2D calculates paths through NavigationRegion2D using A* pathfinding with automatic obstacle avoidance.
Where to Find It
Found under Node2D. Requires NavigationRegion2D with NavigationPolygon.
How to Use
- Set target: Call
target_position = target_global_position. - Move: Call
get_next_path_position()in_physics_process(delta).
Pro Tips
- Use
target_reachedsignal for arrival detection. - Adjust Radius for smoother paths.