Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
NavigationServer3D¶
Inherits: Object
A server interface for low-level 3D navigation access.
Description¶
NavigationServer3D is the server that handles navigation maps, regions and agents. It does not handle A* navigation from AStar3D.
Maps are made up of regions, which are made of navigation meshes. Together, they define the navigable areas in the 3D world.
Note: Most NavigationServer3D changes take effect after the next physics frame and not immediately. This includes all changes made to maps, regions or agents by navigation-related nodes in the scene tree or made through scripts.
For two regions to be connected to each other, they must share a similar edge. An edge is considered connected to another if both of its two vertices are at a distance less than edge_connection_margin
to the respective other edge's vertex.
You may assign navigation layers to regions with region_set_navigation_layers, which then can be checked upon when requesting a path with map_get_path. This can be used to allow or deny certain areas for some objects.
To use the collision avoidance system, you may use agents. You can set an agent's target velocity, then the servers will emit a callback with a modified velocity.
Note: The collision avoidance system ignores regions. Using the modified velocity directly may move an agent outside of the traversable area. This is a limitation of the collision avoidance system, any more complex situation may require the use of the physics engine.
This server keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying.