mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-07 02:12:07 +03:00
371 lines
31 KiB
ReStructuredText
371 lines
31 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the NavigationServer.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_NavigationServer:
|
|
|
|
NavigationServer
|
|
================
|
|
|
|
**Inherits:** :ref:`Object<class_Object>`
|
|
|
|
Server interface for low-level 3D navigation access
|
|
|
|
Description
|
|
-----------
|
|
|
|
NavigationServer is the server responsible for all 3D navigation. It creates the agents, maps, and regions for navigation to work as expected. This 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.
|
|
|
|
Methods
|
|
-------
|
|
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_RID>` | :ref:`agent_create<class_NavigationServer_method_agent_create>` **(** **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`agent_is_map_changed<class_NavigationServer_method_agent_is_map_changed>` **(** :ref:`RID<class_RID>` agent **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`agent_set_callback<class_NavigationServer_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_NavigationServer_method_agent_set_map>` **(** :ref:`RID<class_RID>` agent, :ref:`RID<class_RID>` map **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`agent_set_max_neighbors<class_NavigationServer_method_agent_set_max_neighbors>` **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` count **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`agent_set_max_speed<class_NavigationServer_method_agent_set_max_speed>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` max_speed **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`agent_set_neighbor_dist<class_NavigationServer_method_agent_set_neighbor_dist>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` dist **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`agent_set_position<class_NavigationServer_method_agent_set_position>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector3<class_Vector3>` position **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`agent_set_radius<class_NavigationServer_method_agent_set_radius>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` radius **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`agent_set_target_velocity<class_NavigationServer_method_agent_set_target_velocity>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector3<class_Vector3>` target_velocity **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`agent_set_time_horizon<class_NavigationServer_method_agent_set_time_horizon>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`agent_set_velocity<class_NavigationServer_method_agent_set_velocity>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector3<class_Vector3>` velocity **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`free<class_NavigationServer_method_free>` **(** :ref:`RID<class_RID>` object **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_RID>` | :ref:`map_create<class_NavigationServer_method_map_create>` **(** **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`map_get_cell_size<class_NavigationServer_method_map_get_cell_size>` **(** :ref:`RID<class_RID>` map **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector3<class_Vector3>` | :ref:`map_get_closest_point<class_NavigationServer_method_map_get_closest_point>` **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` to_point **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector3<class_Vector3>` | :ref:`map_get_closest_point_normal<class_NavigationServer_method_map_get_closest_point_normal>` **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` to_point **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_RID>` | :ref:`map_get_closest_point_owner<class_NavigationServer_method_map_get_closest_point_owner>` **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` to_point **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector3<class_Vector3>` | :ref:`map_get_closest_point_to_segment<class_NavigationServer_method_map_get_closest_point_to_segment>` **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` start, :ref:`Vector3<class_Vector3>` end, :ref:`bool<class_bool>` use_collision=false **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`map_get_edge_connection_margin<class_NavigationServer_method_map_get_edge_connection_margin>` **(** :ref:`RID<class_RID>` map **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`map_get_path<class_NavigationServer_method_map_get_path>` **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` origin, :ref:`Vector3<class_Vector3>` destination, :ref:`bool<class_bool>` optimize **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Vector3<class_Vector3>` | :ref:`map_get_up<class_NavigationServer_method_map_get_up>` **(** :ref:`RID<class_RID>` map **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`map_is_active<class_NavigationServer_method_map_is_active>` **(** :ref:`RID<class_RID>` nap **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`map_set_active<class_NavigationServer_method_map_set_active>` **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` active **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`map_set_cell_size<class_NavigationServer_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_NavigationServer_method_map_set_edge_connection_margin>` **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` margin **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`map_set_up<class_NavigationServer_method_map_set_up>` **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` up **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`process<class_NavigationServer_method_process>` **(** :ref:`float<class_float>` delta_time **)** |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`region_bake_navmesh<class_NavigationServer_method_region_bake_navmesh>` **(** :ref:`NavigationMesh<class_NavigationMesh>` mesh, :ref:`Node<class_Node>` node **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_RID>` | :ref:`region_create<class_NavigationServer_method_region_create>` **(** **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`region_set_map<class_NavigationServer_method_region_set_map>` **(** :ref:`RID<class_RID>` region, :ref:`RID<class_RID>` map **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`region_set_navmesh<class_NavigationServer_method_region_set_navmesh>` **(** :ref:`RID<class_RID>` region, :ref:`NavigationMesh<class_NavigationMesh>` nav_mesh **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`region_set_transform<class_NavigationServer_method_region_set_transform>` **(** :ref:`RID<class_RID>` region, :ref:`Transform<class_Transform>` transform **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_active<class_NavigationServer_method_set_active>` **(** :ref:`bool<class_bool>` active **)** const |
|
|
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_NavigationServer_method_agent_create:
|
|
|
|
- :ref:`RID<class_RID>` **agent_create** **(** **)** const
|
|
|
|
Creates the agent.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_is_map_changed:
|
|
|
|
- :ref:`bool<class_bool>` **agent_is_map_changed** **(** :ref:`RID<class_RID>` agent **)** const
|
|
|
|
Returns true if the map got changed the previous frame.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_set_callback:
|
|
|
|
- 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.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_set_map:
|
|
|
|
- void **agent_set_map** **(** :ref:`RID<class_RID>` agent, :ref:`RID<class_RID>` map **)** const
|
|
|
|
Puts the agent in the map.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_set_max_neighbors:
|
|
|
|
- void **agent_set_max_neighbors** **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` count **)** const
|
|
|
|
Sets the maximum number of other agents the agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_set_max_speed:
|
|
|
|
- void **agent_set_max_speed** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` max_speed **)** const
|
|
|
|
Sets the maximum speed of the agent. Must be positive.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_set_neighbor_dist:
|
|
|
|
- void **agent_set_neighbor_dist** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` dist **)** const
|
|
|
|
Sets the maximum distance to other agents this agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_set_position:
|
|
|
|
- void **agent_set_position** **(** :ref:`RID<class_RID>` agent, :ref:`Vector3<class_Vector3>` position **)** const
|
|
|
|
Sets the position of the agent in world space.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_set_radius:
|
|
|
|
- void **agent_set_radius** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` radius **)** const
|
|
|
|
Sets the radius of the agent.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_set_target_velocity:
|
|
|
|
- void **agent_set_target_velocity** **(** :ref:`RID<class_RID>` agent, :ref:`Vector3<class_Vector3>` target_velocity **)** const
|
|
|
|
Sets the new target velocity.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_set_time_horizon:
|
|
|
|
- void **agent_set_time_horizon** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time **)** const
|
|
|
|
The minimal amount of time for which the agent's velocities that are computed by the simulation are safe with respect to other agents. The larger this number, the sooner this agent will respond to the presence of other agents, but the less freedom this agent has in choosing its velocities. Must be positive.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_agent_set_velocity:
|
|
|
|
- void **agent_set_velocity** **(** :ref:`RID<class_RID>` agent, :ref:`Vector3<class_Vector3>` velocity **)** const
|
|
|
|
Sets the current velocity of the agent.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_free:
|
|
|
|
- void **free** **(** :ref:`RID<class_RID>` object **)** const
|
|
|
|
Destroy the RID
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_create:
|
|
|
|
- :ref:`RID<class_RID>` **map_create** **(** **)** const
|
|
|
|
Create a new map.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_get_cell_size:
|
|
|
|
- :ref:`float<class_float>` **map_get_cell_size** **(** :ref:`RID<class_RID>` map **)** const
|
|
|
|
Returns the map cell size.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_get_closest_point:
|
|
|
|
- :ref:`Vector3<class_Vector3>` **map_get_closest_point** **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` to_point **)** const
|
|
|
|
Returns the point closest to the provided ``point`` on the navigation mesh surface.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_get_closest_point_normal:
|
|
|
|
- :ref:`Vector3<class_Vector3>` **map_get_closest_point_normal** **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` to_point **)** const
|
|
|
|
Returns the normal for the point returned by :ref:`map_get_closest_point<class_NavigationServer_method_map_get_closest_point>`.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_get_closest_point_owner:
|
|
|
|
- :ref:`RID<class_RID>` **map_get_closest_point_owner** **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` to_point **)** const
|
|
|
|
Returns the owner region RID for the point returned by :ref:`map_get_closest_point<class_NavigationServer_method_map_get_closest_point>`.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_get_closest_point_to_segment:
|
|
|
|
- :ref:`Vector3<class_Vector3>` **map_get_closest_point_to_segment** **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` start, :ref:`Vector3<class_Vector3>` end, :ref:`bool<class_bool>` use_collision=false **)** const
|
|
|
|
Returns the closest point between the navigation surface and the segment.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_get_edge_connection_margin:
|
|
|
|
- :ref:`float<class_float>` **map_get_edge_connection_margin** **(** :ref:`RID<class_RID>` map **)** const
|
|
|
|
Returns the edge connection margin of the map.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_get_path:
|
|
|
|
- :ref:`PackedVector3Array<class_PackedVector3Array>` **map_get_path** **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` origin, :ref:`Vector3<class_Vector3>` destination, :ref:`bool<class_bool>` optimize **)** const
|
|
|
|
Returns the navigation path to reach the destination from the origin.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_get_up:
|
|
|
|
- :ref:`Vector3<class_Vector3>` **map_get_up** **(** :ref:`RID<class_RID>` map **)** const
|
|
|
|
Returns the map's up direction.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_is_active:
|
|
|
|
- :ref:`bool<class_bool>` **map_is_active** **(** :ref:`RID<class_RID>` nap **)** const
|
|
|
|
Returns true if the map is active.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_set_active:
|
|
|
|
- void **map_set_active** **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` active **)** const
|
|
|
|
Sets the map active.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_set_cell_size:
|
|
|
|
- void **map_set_cell_size** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` cell_size **)** const
|
|
|
|
Set the map cell size used to weld the navigation mesh polygons.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_set_edge_connection_margin:
|
|
|
|
- void **map_set_edge_connection_margin** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` margin **)** const
|
|
|
|
Set the map edge connection margein used to weld the compatible region edges.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_map_set_up:
|
|
|
|
- void **map_set_up** **(** :ref:`RID<class_RID>` map, :ref:`Vector3<class_Vector3>` up **)** const
|
|
|
|
Sets the map up direction.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_process:
|
|
|
|
- void **process** **(** :ref:`float<class_float>` delta_time **)**
|
|
|
|
Process the collision avoidance agents.
|
|
|
|
The result of this process is needed by the physics server, so this must be called in the main thread.
|
|
|
|
Note: This function is not thread safe.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_region_bake_navmesh:
|
|
|
|
- void **region_bake_navmesh** **(** :ref:`NavigationMesh<class_NavigationMesh>` mesh, :ref:`Node<class_Node>` node **)** const
|
|
|
|
Bakes the navigation mesh.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_region_create:
|
|
|
|
- :ref:`RID<class_RID>` **region_create** **(** **)** const
|
|
|
|
Creates a new region.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_region_set_map:
|
|
|
|
- void **region_set_map** **(** :ref:`RID<class_RID>` region, :ref:`RID<class_RID>` map **)** const
|
|
|
|
Sets the map for the region.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_region_set_navmesh:
|
|
|
|
- void **region_set_navmesh** **(** :ref:`RID<class_RID>` region, :ref:`NavigationMesh<class_NavigationMesh>` nav_mesh **)** const
|
|
|
|
Sets the navigation mesh for the region.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_region_set_transform:
|
|
|
|
- void **region_set_transform** **(** :ref:`RID<class_RID>` region, :ref:`Transform<class_Transform>` transform **)** const
|
|
|
|
Sets the global transformation for the region.
|
|
|
|
----
|
|
|
|
.. _class_NavigationServer_method_set_active:
|
|
|
|
- void **set_active** **(** :ref:`bool<class_bool>` active **)** const
|
|
|
|
Control activation of this server.
|
|
|