: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//doc_classes. .. _class_NavigationServer: NavigationServer ================ **Inherits:** :ref:`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` | :ref:`agent_create` **(** **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`agent_is_map_changed` **(** :ref:`RID` agent **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`agent_set_callback` **(** :ref:`RID` agent, :ref:`Object` receiver, :ref:`StringName` method, :ref:`Variant` userdata=null **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`agent_set_map` **(** :ref:`RID` agent, :ref:`RID` map **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`agent_set_max_neighbors` **(** :ref:`RID` agent, :ref:`int` count **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`agent_set_max_speed` **(** :ref:`RID` agent, :ref:`float` max_speed **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`agent_set_neighbor_dist` **(** :ref:`RID` agent, :ref:`float` dist **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`agent_set_position` **(** :ref:`RID` agent, :ref:`Vector3` position **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`agent_set_radius` **(** :ref:`RID` agent, :ref:`float` radius **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`agent_set_target_velocity` **(** :ref:`RID` agent, :ref:`Vector3` target_velocity **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`agent_set_time_horizon` **(** :ref:`RID` agent, :ref:`float` time **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`agent_set_velocity` **(** :ref:`RID` agent, :ref:`Vector3` velocity **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`free` **(** :ref:`RID` object **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`map_create` **(** **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`map_get_cell_size` **(** :ref:`RID` map **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`map_get_closest_point` **(** :ref:`RID` map, :ref:`Vector3` to_point **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`map_get_closest_point_normal` **(** :ref:`RID` map, :ref:`Vector3` to_point **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`map_get_closest_point_owner` **(** :ref:`RID` map, :ref:`Vector3` to_point **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`map_get_closest_point_to_segment` **(** :ref:`RID` map, :ref:`Vector3` start, :ref:`Vector3` end, :ref:`bool` use_collision=false **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`map_get_edge_connection_margin` **(** :ref:`RID` map **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedVector3Array` | :ref:`map_get_path` **(** :ref:`RID` map, :ref:`Vector3` origin, :ref:`Vector3` destination, :ref:`bool` optimize **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`map_get_up` **(** :ref:`RID` map **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`map_is_active` **(** :ref:`RID` nap **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`map_set_active` **(** :ref:`RID` map, :ref:`bool` active **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`map_set_cell_size` **(** :ref:`RID` map, :ref:`float` cell_size **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`map_set_edge_connection_margin` **(** :ref:`RID` map, :ref:`float` margin **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`map_set_up` **(** :ref:`RID` map, :ref:`Vector3` up **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`process` **(** :ref:`float` delta_time **)** | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`region_bake_navmesh` **(** :ref:`NavigationMesh` mesh, :ref:`Node` node **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`region_create` **(** **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`region_set_map` **(** :ref:`RID` region, :ref:`RID` map **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`region_set_navmesh` **(** :ref:`RID` region, :ref:`NavigationMesh` nav_mesh **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`region_set_transform` **(** :ref:`RID` region, :ref:`Transform` transform **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_active` **(** :ref:`bool` active **)** const | +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Method Descriptions ------------------- .. _class_NavigationServer_method_agent_create: - :ref:`RID` **agent_create** **(** **)** const Creates the agent. ---- .. _class_NavigationServer_method_agent_is_map_changed: - :ref:`bool` **agent_is_map_changed** **(** :ref:`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` agent, :ref:`Object` receiver, :ref:`StringName` method, :ref:`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` agent, :ref:`RID` map **)** const Puts the agent in the map. ---- .. _class_NavigationServer_method_agent_set_max_neighbors: - void **agent_set_max_neighbors** **(** :ref:`RID` agent, :ref:`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` agent, :ref:`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` agent, :ref:`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` agent, :ref:`Vector3` position **)** const Sets the position of the agent in world space. ---- .. _class_NavigationServer_method_agent_set_radius: - void **agent_set_radius** **(** :ref:`RID` agent, :ref:`float` radius **)** const Sets the radius of the agent. ---- .. _class_NavigationServer_method_agent_set_target_velocity: - void **agent_set_target_velocity** **(** :ref:`RID` agent, :ref:`Vector3` target_velocity **)** const Sets the new target velocity. ---- .. _class_NavigationServer_method_agent_set_time_horizon: - void **agent_set_time_horizon** **(** :ref:`RID` agent, :ref:`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` agent, :ref:`Vector3` velocity **)** const Sets the current velocity of the agent. ---- .. _class_NavigationServer_method_free: - void **free** **(** :ref:`RID` object **)** const Destroy the RID ---- .. _class_NavigationServer_method_map_create: - :ref:`RID` **map_create** **(** **)** const Create a new map. ---- .. _class_NavigationServer_method_map_get_cell_size: - :ref:`float` **map_get_cell_size** **(** :ref:`RID` map **)** const Returns the map cell size. ---- .. _class_NavigationServer_method_map_get_closest_point: - :ref:`Vector3` **map_get_closest_point** **(** :ref:`RID` map, :ref:`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` **map_get_closest_point_normal** **(** :ref:`RID` map, :ref:`Vector3` to_point **)** const Returns the normal for the point returned by :ref:`map_get_closest_point`. ---- .. _class_NavigationServer_method_map_get_closest_point_owner: - :ref:`RID` **map_get_closest_point_owner** **(** :ref:`RID` map, :ref:`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_to_segment: - :ref:`Vector3` **map_get_closest_point_to_segment** **(** :ref:`RID` map, :ref:`Vector3` start, :ref:`Vector3` end, :ref:`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` **map_get_edge_connection_margin** **(** :ref:`RID` map **)** const Returns the edge connection margin of the map. ---- .. _class_NavigationServer_method_map_get_path: - :ref:`PackedVector3Array` **map_get_path** **(** :ref:`RID` map, :ref:`Vector3` origin, :ref:`Vector3` destination, :ref:`bool` optimize **)** const Returns the navigation path to reach the destination from the origin. ---- .. _class_NavigationServer_method_map_get_up: - :ref:`Vector3` **map_get_up** **(** :ref:`RID` map **)** const Returns the map's up direction. ---- .. _class_NavigationServer_method_map_is_active: - :ref:`bool` **map_is_active** **(** :ref:`RID` nap **)** const Returns true if the map is active. ---- .. _class_NavigationServer_method_map_set_active: - void **map_set_active** **(** :ref:`RID` map, :ref:`bool` active **)** const Sets the map active. ---- .. _class_NavigationServer_method_map_set_cell_size: - void **map_set_cell_size** **(** :ref:`RID` map, :ref:`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` map, :ref:`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` map, :ref:`Vector3` up **)** const Sets the map up direction. ---- .. _class_NavigationServer_method_process: - void **process** **(** :ref:`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` mesh, :ref:`Node` node **)** const Bakes the navigation mesh. ---- .. _class_NavigationServer_method_region_create: - :ref:`RID` **region_create** **(** **)** const Creates a new region. ---- .. _class_NavigationServer_method_region_set_map: - void **region_set_map** **(** :ref:`RID` region, :ref:`RID` map **)** const Sets the map for the region. ---- .. _class_NavigationServer_method_region_set_navmesh: - void **region_set_navmesh** **(** :ref:`RID` region, :ref:`NavigationMesh` nav_mesh **)** const Sets the navigation mesh for the region. ---- .. _class_NavigationServer_method_region_set_transform: - void **region_set_transform** **(** :ref:`RID` region, :ref:`Transform` transform **)** const Sets the global transformation for the region. ---- .. _class_NavigationServer_method_set_active: - void **set_active** **(** :ref:`bool` active **)** const Control activation of this server.