classref: Sync with current master branch (c4f0062f1)

This commit is contained in:
Rémi Verschelde
2022-06-25 12:45:02 +02:00
parent ecaaa4f960
commit 61fd183807
91 changed files with 3943 additions and 2461 deletions

View File

@@ -24,7 +24,7 @@ Maps are made up of regions, which are made of navigation polygons. Together, th
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 :ref:`region_set_layers<class_NavigationServer2D_method_region_set_layers>`, which then can be checked upon when requesting a path with :ref:`map_get_path<class_NavigationServer2D_method_map_get_path>`. This allows allowing or forbidding some areas to 2D objects.
You may assign navigation layers to regions with :ref:`region_set_navigation_layers<class_NavigationServer2D_method_region_set_navigation_layers>`, which then can be checked upon when requesting a path with :ref:`map_get_path<class_NavigationServer2D_method_map_get_path>`. This allows allowing or forbidding some areas to 2D 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.
@@ -40,79 +40,93 @@ Tutorials
Methods
-------
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`agent_create<class_NavigationServer2D_method_agent_create>` **(** **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`agent_get_map<class_NavigationServer2D_method_agent_get_map>` **(** :ref:`RID<class_RID>` agent **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`agent_is_map_changed<class_NavigationServer2D_method_agent_is_map_changed>` **(** :ref:`RID<class_RID>` agent **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_callback<class_NavigationServer2D_method_agent_set_callback>` **(** :ref:`RID<class_RID>` agent, :ref:`Object<class_Object>` receiver, :ref:`StringName<class_StringName>` method, :ref:`Variant<class_Variant>` userdata=null **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_map<class_NavigationServer2D_method_agent_set_map>` **(** :ref:`RID<class_RID>` agent, :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_max_neighbors<class_NavigationServer2D_method_agent_set_max_neighbors>` **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` count **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_max_speed<class_NavigationServer2D_method_agent_set_max_speed>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` max_speed **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_neighbor_dist<class_NavigationServer2D_method_agent_set_neighbor_dist>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` dist **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_position<class_NavigationServer2D_method_agent_set_position>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` position **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_radius<class_NavigationServer2D_method_agent_set_radius>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` radius **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_target_velocity<class_NavigationServer2D_method_agent_set_target_velocity>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` target_velocity **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_time_horizon<class_NavigationServer2D_method_agent_set_time_horizon>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_velocity<class_NavigationServer2D_method_agent_set_velocity>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`free_rid<class_NavigationServer2D_method_free_rid>` **(** :ref:`RID<class_RID>` rid **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`map_create<class_NavigationServer2D_method_map_create>` **(** **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`map_get_agents<class_NavigationServer2D_method_map_get_agents>` **(** :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`map_get_cell_size<class_NavigationServer2D_method_map_get_cell_size>` **(** :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`map_get_closest_point<class_NavigationServer2D_method_map_get_closest_point>` **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` to_point **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`map_get_closest_point_owner<class_NavigationServer2D_method_map_get_closest_point_owner>` **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` to_point **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`map_get_edge_connection_margin<class_NavigationServer2D_method_map_get_edge_connection_margin>` **(** :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`map_get_path<class_NavigationServer2D_method_map_get_path>` **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` origin, :ref:`Vector2<class_Vector2>` destination, :ref:`bool<class_bool>` optimize, :ref:`int<class_int>` layers=1 **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`map_get_regions<class_NavigationServer2D_method_map_get_regions>` **(** :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`map_is_active<class_NavigationServer2D_method_map_is_active>` **(** :ref:`RID<class_RID>` nap **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`map_set_active<class_NavigationServer2D_method_map_set_active>` **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` active **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`map_set_cell_size<class_NavigationServer2D_method_map_set_cell_size>` **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` cell_size **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`map_set_edge_connection_margin<class_NavigationServer2D_method_map_set_edge_connection_margin>` **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` margin **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`region_create<class_NavigationServer2D_method_region_create>` **(** **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`region_get_connection_pathway_end<class_NavigationServer2D_method_region_get_connection_pathway_end>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` connection **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`region_get_connection_pathway_start<class_NavigationServer2D_method_region_get_connection_pathway_start>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` connection **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`region_get_connections_count<class_NavigationServer2D_method_region_get_connections_count>` **(** :ref:`RID<class_RID>` region **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`region_get_layers<class_NavigationServer2D_method_region_get_layers>` **(** :ref:`RID<class_RID>` region **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`region_get_map<class_NavigationServer2D_method_region_get_map>` **(** :ref:`RID<class_RID>` region **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`region_set_layers<class_NavigationServer2D_method_region_set_layers>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` layers **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`region_set_map<class_NavigationServer2D_method_region_set_map>` **(** :ref:`RID<class_RID>` region, :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`region_set_navpoly<class_NavigationServer2D_method_region_set_navpoly>` **(** :ref:`RID<class_RID>` region, :ref:`NavigationPolygon<class_NavigationPolygon>` nav_poly **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`region_set_transform<class_NavigationServer2D_method_region_set_transform>` **(** :ref:`RID<class_RID>` region, :ref:`Transform2D<class_Transform2D>` transform **)** |const| |
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`agent_create<class_NavigationServer2D_method_agent_create>` **(** **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`agent_get_map<class_NavigationServer2D_method_agent_get_map>` **(** :ref:`RID<class_RID>` agent **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`agent_is_map_changed<class_NavigationServer2D_method_agent_is_map_changed>` **(** :ref:`RID<class_RID>` agent **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_callback<class_NavigationServer2D_method_agent_set_callback>` **(** :ref:`RID<class_RID>` agent, :ref:`Object<class_Object>` receiver, :ref:`StringName<class_StringName>` method, :ref:`Variant<class_Variant>` userdata=null **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_map<class_NavigationServer2D_method_agent_set_map>` **(** :ref:`RID<class_RID>` agent, :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_max_neighbors<class_NavigationServer2D_method_agent_set_max_neighbors>` **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` count **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_max_speed<class_NavigationServer2D_method_agent_set_max_speed>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` max_speed **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_neighbor_dist<class_NavigationServer2D_method_agent_set_neighbor_dist>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` dist **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_position<class_NavigationServer2D_method_agent_set_position>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` position **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_radius<class_NavigationServer2D_method_agent_set_radius>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` radius **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_target_velocity<class_NavigationServer2D_method_agent_set_target_velocity>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` target_velocity **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_time_horizon<class_NavigationServer2D_method_agent_set_time_horizon>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`agent_set_velocity<class_NavigationServer2D_method_agent_set_velocity>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`free_rid<class_NavigationServer2D_method_free_rid>` **(** :ref:`RID<class_RID>` rid **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_maps<class_NavigationServer2D_method_get_maps>` **(** **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`map_create<class_NavigationServer2D_method_map_create>` **(** **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`map_force_update<class_NavigationServer2D_method_map_force_update>` **(** :ref:`RID<class_RID>` map **)** |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`map_get_agents<class_NavigationServer2D_method_map_get_agents>` **(** :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`map_get_cell_size<class_NavigationServer2D_method_map_get_cell_size>` **(** :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`map_get_closest_point<class_NavigationServer2D_method_map_get_closest_point>` **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` to_point **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`map_get_closest_point_owner<class_NavigationServer2D_method_map_get_closest_point_owner>` **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` to_point **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`map_get_edge_connection_margin<class_NavigationServer2D_method_map_get_edge_connection_margin>` **(** :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`map_get_path<class_NavigationServer2D_method_map_get_path>` **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` origin, :ref:`Vector2<class_Vector2>` destination, :ref:`bool<class_bool>` optimize, :ref:`int<class_int>` navigation_layers=1 **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`map_get_regions<class_NavigationServer2D_method_map_get_regions>` **(** :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`map_is_active<class_NavigationServer2D_method_map_is_active>` **(** :ref:`RID<class_RID>` nap **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`map_set_active<class_NavigationServer2D_method_map_set_active>` **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` active **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`map_set_cell_size<class_NavigationServer2D_method_map_set_cell_size>` **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` cell_size **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`map_set_edge_connection_margin<class_NavigationServer2D_method_map_set_edge_connection_margin>` **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` margin **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`region_create<class_NavigationServer2D_method_region_create>` **(** **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`region_get_connection_pathway_end<class_NavigationServer2D_method_region_get_connection_pathway_end>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` connection **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`region_get_connection_pathway_start<class_NavigationServer2D_method_region_get_connection_pathway_start>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` connection **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`region_get_connections_count<class_NavigationServer2D_method_region_get_connections_count>` **(** :ref:`RID<class_RID>` region **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`region_get_enter_cost<class_NavigationServer2D_method_region_get_enter_cost>` **(** :ref:`RID<class_RID>` region **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`region_get_map<class_NavigationServer2D_method_region_get_map>` **(** :ref:`RID<class_RID>` region **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`region_get_navigation_layers<class_NavigationServer2D_method_region_get_navigation_layers>` **(** :ref:`RID<class_RID>` region **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`region_get_travel_cost<class_NavigationServer2D_method_region_get_travel_cost>` **(** :ref:`RID<class_RID>` region **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`region_owns_point<class_NavigationServer2D_method_region_owns_point>` **(** :ref:`RID<class_RID>` region, :ref:`Vector2<class_Vector2>` point **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`region_set_enter_cost<class_NavigationServer2D_method_region_set_enter_cost>` **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` enter_cost **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`region_set_map<class_NavigationServer2D_method_region_set_map>` **(** :ref:`RID<class_RID>` region, :ref:`RID<class_RID>` map **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`region_set_navigation_layers<class_NavigationServer2D_method_region_set_navigation_layers>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` navigation_layers **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`region_set_navpoly<class_NavigationServer2D_method_region_set_navpoly>` **(** :ref:`RID<class_RID>` region, :ref:`NavigationPolygon<class_NavigationPolygon>` nav_poly **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`region_set_transform<class_NavigationServer2D_method_region_set_transform>` **(** :ref:`RID<class_RID>` region, :ref:`Transform2D<class_Transform2D>` transform **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`region_set_travel_cost<class_NavigationServer2D_method_region_set_travel_cost>` **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` travel_cost **)** |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Signals
-------
@@ -154,7 +168,9 @@ Returns true if the map got changed the previous frame.
- void **agent_set_callback** **(** :ref:`RID<class_RID>` agent, :ref:`Object<class_Object>` receiver, :ref:`StringName<class_StringName>` method, :ref:`Variant<class_Variant>` userdata=null **)** |const|
Callback called at the end of the RVO process.
Callback called at the end of the RVO process. If a callback is created manually and the agent is placed on a navigation map it will calculate avoidance for the agent and dispatch the calculated ``safe_velocity`` to the ``receiver`` object with a signal to the chosen ``method`` name.
\ **Note:** Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use :ref:`agent_set_callback<class_NavigationServer2D_method_agent_set_callback>` again with a ``null`` object as the ``receiver``.
----
@@ -238,6 +254,14 @@ Destroys the given RID.
----
.. _class_NavigationServer2D_method_get_maps:
- :ref:`Array<class_Array>` **get_maps** **(** **)** |const|
Returns all created navigation map :ref:`RID<class_RID>`\ s on the NavigationServer. This returns both 2D and 3D created navigation maps as there is technically no distinction between them.
----
.. _class_NavigationServer2D_method_map_create:
- :ref:`RID<class_RID>` **map_create** **(** **)** |const|
@@ -246,6 +270,20 @@ Create a new map.
----
.. _class_NavigationServer2D_method_map_force_update:
- void **map_force_update** **(** :ref:`RID<class_RID>` map **)**
This function immediately forces synchronization of the specified navigation ``map`` :ref:`RID<class_RID>`. By default navigation maps are only synchronized at the end of each physics frame. This function can be used to immediately (re)calculate all the navigation meshes and region connections of the navigation map. This makes it possible to query a navigation path for a changed map immediately and in the same frame (multiple times if needed).
Due to technical restrictions the current NavigationServer command queue will be flushed. This means all already queued update commands for this physics frame will be executed, even those intended for other maps, regions and agents not part of the specified map. The expensive computation of the navigation meshes and region connections of a map will only be done for the specified map. Other maps will receive the normal synchronization at the end of the physics frame. Should the specified map receive changes after the forced update it will update again as well when the other maps receive their update.
Avoidance processing and dispatch of the ``safe_velocity`` signals is untouched by this function and continues to happen for all maps and agents at the end of the physics frame.
\ **Note:** With great power comes great responsibility. This function should only be used by users that really know what they are doing and have a good reason for it. Forcing an immediate update of a navigation map requires locking the NavigationServer and flushing the entire NavigationServer command queue. Not only can this severely impact the performance of a game but it can also introduce bugs if used inappropriately without much foresight.
----
.. _class_NavigationServer2D_method_map_get_agents:
- :ref:`Array<class_Array>` **map_get_agents** **(** :ref:`RID<class_RID>` map **)** |const|
@@ -288,9 +326,9 @@ Returns the edge connection margin of the map. The edge connection margin is a d
.. _class_NavigationServer2D_method_map_get_path:
- :ref:`PackedVector2Array<class_PackedVector2Array>` **map_get_path** **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` origin, :ref:`Vector2<class_Vector2>` destination, :ref:`bool<class_bool>` optimize, :ref:`int<class_int>` layers=1 **)** |const|
- :ref:`PackedVector2Array<class_PackedVector2Array>` **map_get_path** **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` origin, :ref:`Vector2<class_Vector2>` destination, :ref:`bool<class_bool>` optimize, :ref:`int<class_int>` navigation_layers=1 **)** |const|
Returns the navigation path to reach the destination from the origin. ``layers`` is a bitmask of all region layers that are allowed to be in the path.
Returns the navigation path to reach the destination from the origin. ``navigation_layers`` is a bitmask of all region navigation layers that are allowed to be in the path.
----
@@ -366,11 +404,11 @@ Returns how many connections this ``region`` has with other regions in the map.
----
.. _class_NavigationServer2D_method_region_get_layers:
.. _class_NavigationServer2D_method_region_get_enter_cost:
- :ref:`int<class_int>` **region_get_layers** **(** :ref:`RID<class_RID>` region **)** |const|
- :ref:`float<class_float>` **region_get_enter_cost** **(** :ref:`RID<class_RID>` region **)** |const|
Returns the region's layers.
Returns the ``enter_cost`` of this ``region``.
----
@@ -382,11 +420,39 @@ Returns the navigation map :ref:`RID<class_RID>` the requested ``region`` is cur
----
.. _class_NavigationServer2D_method_region_set_layers:
.. _class_NavigationServer2D_method_region_get_navigation_layers:
- void **region_set_layers** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` layers **)** |const|
- :ref:`int<class_int>` **region_get_navigation_layers** **(** :ref:`RID<class_RID>` region **)** |const|
Set the region's layers. This allows selecting regions from a path request (when using :ref:`map_get_path<class_NavigationServer2D_method_map_get_path>`).
Returns the region's navigation layers.
----
.. _class_NavigationServer2D_method_region_get_travel_cost:
- :ref:`float<class_float>` **region_get_travel_cost** **(** :ref:`RID<class_RID>` region **)** |const|
Returns the ``travel_cost`` of this ``region``.
----
.. _class_NavigationServer2D_method_region_owns_point:
- :ref:`bool<class_bool>` **region_owns_point** **(** :ref:`RID<class_RID>` region, :ref:`Vector2<class_Vector2>` point **)** |const|
Returns ``true`` if the provided ``point`` in world space is currently owned by the provided navigation ``region``. Owned in this context means that one of the region's navigation mesh polygon faces has a possible position at the closest distance to this point compared to all other navigation meshes from other navigation regions that are also registered on the navigation map of the provided region.
If multiple navigation meshes have positions at equal distance the navigation region whose polygons are processed first wins the ownership. Polygons are processed in the same order that navigation regions were registered on the NavigationServer.
\ **Note:** If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected.
----
.. _class_NavigationServer2D_method_region_set_enter_cost:
- void **region_set_enter_cost** **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` enter_cost **)** |const|
Sets the ``enter_cost`` for this ``region``.
----
@@ -398,6 +464,14 @@ Sets the map for the region.
----
.. _class_NavigationServer2D_method_region_set_navigation_layers:
- void **region_set_navigation_layers** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` navigation_layers **)** |const|
Set the region's navigation layers. This allows selecting regions from a path request (when using :ref:`map_get_path<class_NavigationServer2D_method_map_get_path>`).
----
.. _class_NavigationServer2D_method_region_set_navpoly:
- void **region_set_navpoly** **(** :ref:`RID<class_RID>` region, :ref:`NavigationPolygon<class_NavigationPolygon>` nav_poly **)** |const|
@@ -412,6 +486,14 @@ Sets the navigation mesh for the region.
Sets the global transformation for the region.
----
.. _class_NavigationServer2D_method_region_set_travel_cost:
- void **region_set_travel_cost** **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` travel_cost **)** |const|
Sets the ``travel_cost`` for this ``region``.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`