Pathfinding
2025/12/27
- Type
- Learning Resource
- Format
- Glossary Article
- Version
- General
- Subject Tags
- Created
- Updated
- 2026/02/16
- 2025/12/27
Pathfinding algorithms are a family of algorithms that aim to find an efficient path between two points, avoiding obstacles along the way. They are used to make AIs navigate around game levels, although not exclusively: GPS services also use these algorithms to find efficient routes to your destination.
Godot provides the most widely used pathfinding algorithm in games and many other domains: AStar. It's a flexible and efficient algorithm that's excellent at finding the optimal path between two points.
The engine both provides it as a class you can use to build and traverse your maps manually and uses it as part of its navigation system, which finds efficient geometric paths on navigation meshes.
In games, we use pathfinding algorithms to make AIs navigate around complex game worlds. For example:
As mentioned above, Godot uses the AStar algorithm for pathfinding. The engine provides two classes to use it directly:
AStar2D for 2D games. It's particularly useful for grid-based games, regardless of the grid type (square, hexagonal, etc.).AStar3D for 3D games. Similarly, it's useful for grid-based games.The engine also provides a more advanced pathfinding system called "navigation" that uses AStar internally:
These nodes allow AI-controlled entities called "agents" to find the shortest path between two points in the navigation regions. They can also avoid obstacles and other agents almost automatically. It's a powerful system with many features and settings.
Don't stop here. Step-by-step tutorials are fun but they only take you so far.
Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.
Get help from peers and pros on GDQuest's Discord server!
20,000 membersJoin ServerThere are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!
Sponsor this library by learning gamedev with us onGDSchool
Learn MoreImprove and build on assets or suggest edits onGithub
Contributeshare this page and talk about GDQUest onRedditYoutubeTwitter…