class_navigationserver2d.rst 99 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.1/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.1/doc/classes/NavigationServer2D.xml.
  6. .. _class_NavigationServer2D:
  7. NavigationServer2D
  8. ==================
  9. **Inherits:** :ref:`Object<class_Object>`
  10. A server interface for low-level 2D navigation access.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. NavigationServer2D is the server that handles navigation maps, regions and agents. It does not handle A\* navigation from :ref:`AStar2D<class_AStar2D>` or :ref:`AStarGrid2D<class_AStarGrid2D>`.
  15. Maps are made up of regions, which are made of navigation polygons. Together, they define the traversable areas in the 2D world.
  16. \ **Note:** Most **NavigationServer2D** changes take effect after the next physics frame and not immediately. This includes all changes made to maps, regions or agents by navigation-related nodes in the scene tree or made through scripts.
  17. 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.
  18. 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 can be used to allow or deny certain areas for some objects.
  19. 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.
  20. \ **Note:** The collision avoidance system ignores regions. Using the modified velocity directly may move an agent outside of the traversable area. This is a limitation of the collision avoidance system, any more complex situation may require the use of the physics engine.
  21. This server keeps tracks of any call and executes them during the sync phase. This means that you can request any change to the map, using any thread, without worrying.
  22. .. rst-class:: classref-introduction-group
  23. Tutorials
  24. ---------
  25. - `2D Navigation Demo <https://godotengine.org/asset-library/asset/117>`__
  26. - :doc:`Using NavigationServer <../tutorials/navigation/navigation_using_navigationservers>`
  27. .. rst-class:: classref-reftable-group
  28. Methods
  29. -------
  30. .. table::
  31. :widths: auto
  32. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`RID<class_RID>` | :ref:`agent_create<class_NavigationServer2D_method_agent_create>` **(** **)** |
  34. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`agent_get_avoidance_enabled<class_NavigationServer2D_method_agent_get_avoidance_enabled>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  36. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`RID<class_RID>` | :ref:`agent_get_map<class_NavigationServer2D_method_agent_get_map>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  38. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`agent_get_paused<class_NavigationServer2D_method_agent_get_paused>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  40. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`agent_is_map_changed<class_NavigationServer2D_method_agent_is_map_changed>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  42. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`agent_set_avoidance_callback<class_NavigationServer2D_method_agent_set_avoidance_callback>` **(** :ref:`RID<class_RID>` agent, :ref:`Callable<class_Callable>` callback **)** |
  44. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`agent_set_avoidance_enabled<class_NavigationServer2D_method_agent_set_avoidance_enabled>` **(** :ref:`RID<class_RID>` agent, :ref:`bool<class_bool>` enabled **)** |
  46. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`agent_set_avoidance_layers<class_NavigationServer2D_method_agent_set_avoidance_layers>` **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` layers **)** |
  48. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`agent_set_avoidance_mask<class_NavigationServer2D_method_agent_set_avoidance_mask>` **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` mask **)** |
  50. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`agent_set_avoidance_priority<class_NavigationServer2D_method_agent_set_avoidance_priority>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` priority **)** |
  52. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`agent_set_map<class_NavigationServer2D_method_agent_set_map>` **(** :ref:`RID<class_RID>` agent, :ref:`RID<class_RID>` map **)** |
  54. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`agent_set_max_neighbors<class_NavigationServer2D_method_agent_set_max_neighbors>` **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` count **)** |
  56. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`agent_set_max_speed<class_NavigationServer2D_method_agent_set_max_speed>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` max_speed **)** |
  58. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`agent_set_neighbor_distance<class_NavigationServer2D_method_agent_set_neighbor_distance>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` distance **)** |
  60. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`agent_set_paused<class_NavigationServer2D_method_agent_set_paused>` **(** :ref:`RID<class_RID>` agent, :ref:`bool<class_bool>` paused **)** |
  62. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`agent_set_position<class_NavigationServer2D_method_agent_set_position>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` position **)** |
  64. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`agent_set_radius<class_NavigationServer2D_method_agent_set_radius>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` radius **)** |
  66. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`agent_set_time_horizon_agents<class_NavigationServer2D_method_agent_set_time_horizon_agents>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time_horizon **)** |
  68. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`agent_set_time_horizon_obstacles<class_NavigationServer2D_method_agent_set_time_horizon_obstacles>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time_horizon **)** |
  70. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`agent_set_velocity<class_NavigationServer2D_method_agent_set_velocity>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)** |
  72. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`agent_set_velocity_forced<class_NavigationServer2D_method_agent_set_velocity_forced>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)** |
  74. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`free_rid<class_NavigationServer2D_method_free_rid>` **(** :ref:`RID<class_RID>` rid **)** |
  76. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`bool<class_bool>` | :ref:`get_debug_enabled<class_NavigationServer2D_method_get_debug_enabled>` **(** **)** |const| |
  78. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`RID[]<class_RID>` | :ref:`get_maps<class_NavigationServer2D_method_get_maps>` **(** **)** |const| |
  80. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`RID<class_RID>` | :ref:`link_create<class_NavigationServer2D_method_link_create>` **(** **)** |
  82. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Vector2<class_Vector2>` | :ref:`link_get_end_position<class_NavigationServer2D_method_link_get_end_position>` **(** :ref:`RID<class_RID>` link **)** |const| |
  84. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`float<class_float>` | :ref:`link_get_enter_cost<class_NavigationServer2D_method_link_get_enter_cost>` **(** :ref:`RID<class_RID>` link **)** |const| |
  86. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`RID<class_RID>` | :ref:`link_get_map<class_NavigationServer2D_method_link_get_map>` **(** :ref:`RID<class_RID>` link **)** |const| |
  88. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`int<class_int>` | :ref:`link_get_navigation_layers<class_NavigationServer2D_method_link_get_navigation_layers>` **(** :ref:`RID<class_RID>` link **)** |const| |
  90. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`int<class_int>` | :ref:`link_get_owner_id<class_NavigationServer2D_method_link_get_owner_id>` **(** :ref:`RID<class_RID>` link **)** |const| |
  92. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`Vector2<class_Vector2>` | :ref:`link_get_start_position<class_NavigationServer2D_method_link_get_start_position>` **(** :ref:`RID<class_RID>` link **)** |const| |
  94. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`float<class_float>` | :ref:`link_get_travel_cost<class_NavigationServer2D_method_link_get_travel_cost>` **(** :ref:`RID<class_RID>` link **)** |const| |
  96. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`bool<class_bool>` | :ref:`link_is_bidirectional<class_NavigationServer2D_method_link_is_bidirectional>` **(** :ref:`RID<class_RID>` link **)** |const| |
  98. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | void | :ref:`link_set_bidirectional<class_NavigationServer2D_method_link_set_bidirectional>` **(** :ref:`RID<class_RID>` link, :ref:`bool<class_bool>` bidirectional **)** |
  100. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | void | :ref:`link_set_end_position<class_NavigationServer2D_method_link_set_end_position>` **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)** |
  102. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | void | :ref:`link_set_enter_cost<class_NavigationServer2D_method_link_set_enter_cost>` **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` enter_cost **)** |
  104. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | void | :ref:`link_set_map<class_NavigationServer2D_method_link_set_map>` **(** :ref:`RID<class_RID>` link, :ref:`RID<class_RID>` map **)** |
  106. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | void | :ref:`link_set_navigation_layers<class_NavigationServer2D_method_link_set_navigation_layers>` **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` navigation_layers **)** |
  108. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | void | :ref:`link_set_owner_id<class_NavigationServer2D_method_link_set_owner_id>` **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` owner_id **)** |
  110. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | void | :ref:`link_set_start_position<class_NavigationServer2D_method_link_set_start_position>` **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)** |
  112. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | void | :ref:`link_set_travel_cost<class_NavigationServer2D_method_link_set_travel_cost>` **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` travel_cost **)** |
  114. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`RID<class_RID>` | :ref:`map_create<class_NavigationServer2D_method_map_create>` **(** **)** |
  116. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | void | :ref:`map_force_update<class_NavigationServer2D_method_map_force_update>` **(** :ref:`RID<class_RID>` map **)** |
  118. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | :ref:`RID[]<class_RID>` | :ref:`map_get_agents<class_NavigationServer2D_method_map_get_agents>` **(** :ref:`RID<class_RID>` map **)** |const| |
  120. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | :ref:`float<class_float>` | :ref:`map_get_cell_size<class_NavigationServer2D_method_map_get_cell_size>` **(** :ref:`RID<class_RID>` map **)** |const| |
  122. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | :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| |
  124. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | :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| |
  126. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`float<class_float>` | :ref:`map_get_edge_connection_margin<class_NavigationServer2D_method_map_get_edge_connection_margin>` **(** :ref:`RID<class_RID>` map **)** |const| |
  128. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`float<class_float>` | :ref:`map_get_link_connection_radius<class_NavigationServer2D_method_map_get_link_connection_radius>` **(** :ref:`RID<class_RID>` map **)** |const| |
  130. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | :ref:`RID[]<class_RID>` | :ref:`map_get_links<class_NavigationServer2D_method_map_get_links>` **(** :ref:`RID<class_RID>` map **)** |const| |
  132. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | :ref:`RID[]<class_RID>` | :ref:`map_get_obstacles<class_NavigationServer2D_method_map_get_obstacles>` **(** :ref:`RID<class_RID>` map **)** |const| |
  134. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | :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| |
  136. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | :ref:`RID[]<class_RID>` | :ref:`map_get_regions<class_NavigationServer2D_method_map_get_regions>` **(** :ref:`RID<class_RID>` map **)** |const| |
  138. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | :ref:`bool<class_bool>` | :ref:`map_get_use_edge_connections<class_NavigationServer2D_method_map_get_use_edge_connections>` **(** :ref:`RID<class_RID>` map **)** |const| |
  140. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | :ref:`bool<class_bool>` | :ref:`map_is_active<class_NavigationServer2D_method_map_is_active>` **(** :ref:`RID<class_RID>` map **)** |const| |
  142. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | void | :ref:`map_set_active<class_NavigationServer2D_method_map_set_active>` **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` active **)** |
  144. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | void | :ref:`map_set_cell_size<class_NavigationServer2D_method_map_set_cell_size>` **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` cell_size **)** |
  146. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | 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 **)** |
  148. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | void | :ref:`map_set_link_connection_radius<class_NavigationServer2D_method_map_set_link_connection_radius>` **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` radius **)** |
  150. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | void | :ref:`map_set_use_edge_connections<class_NavigationServer2D_method_map_set_use_edge_connections>` **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` enabled **)** |
  152. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. | :ref:`RID<class_RID>` | :ref:`obstacle_create<class_NavigationServer2D_method_obstacle_create>` **(** **)** |
  154. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  155. | :ref:`bool<class_bool>` | :ref:`obstacle_get_avoidance_enabled<class_NavigationServer2D_method_obstacle_get_avoidance_enabled>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  156. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  157. | :ref:`RID<class_RID>` | :ref:`obstacle_get_map<class_NavigationServer2D_method_obstacle_get_map>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  158. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  159. | :ref:`bool<class_bool>` | :ref:`obstacle_get_paused<class_NavigationServer2D_method_obstacle_get_paused>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  160. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  161. | void | :ref:`obstacle_set_avoidance_enabled<class_NavigationServer2D_method_obstacle_set_avoidance_enabled>` **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` enabled **)** |
  162. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  163. | void | :ref:`obstacle_set_avoidance_layers<class_NavigationServer2D_method_obstacle_set_avoidance_layers>` **(** :ref:`RID<class_RID>` obstacle, :ref:`int<class_int>` layers **)** |
  164. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  165. | void | :ref:`obstacle_set_map<class_NavigationServer2D_method_obstacle_set_map>` **(** :ref:`RID<class_RID>` obstacle, :ref:`RID<class_RID>` map **)** |
  166. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  167. | void | :ref:`obstacle_set_paused<class_NavigationServer2D_method_obstacle_set_paused>` **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` paused **)** |
  168. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  169. | void | :ref:`obstacle_set_position<class_NavigationServer2D_method_obstacle_set_position>` **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` position **)** |
  170. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  171. | void | :ref:`obstacle_set_radius<class_NavigationServer2D_method_obstacle_set_radius>` **(** :ref:`RID<class_RID>` obstacle, :ref:`float<class_float>` radius **)** |
  172. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  173. | void | :ref:`obstacle_set_velocity<class_NavigationServer2D_method_obstacle_set_velocity>` **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` velocity **)** |
  174. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  175. | void | :ref:`obstacle_set_vertices<class_NavigationServer2D_method_obstacle_set_vertices>` **(** :ref:`RID<class_RID>` obstacle, :ref:`PackedVector2Array<class_PackedVector2Array>` vertices **)** |
  176. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  177. | void | :ref:`query_path<class_NavigationServer2D_method_query_path>` **(** :ref:`NavigationPathQueryParameters2D<class_NavigationPathQueryParameters2D>` parameters, :ref:`NavigationPathQueryResult2D<class_NavigationPathQueryResult2D>` result **)** |const| |
  178. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  179. | :ref:`RID<class_RID>` | :ref:`region_create<class_NavigationServer2D_method_region_create>` **(** **)** |
  180. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  181. | :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| |
  182. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  183. | :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| |
  184. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  185. | :ref:`int<class_int>` | :ref:`region_get_connections_count<class_NavigationServer2D_method_region_get_connections_count>` **(** :ref:`RID<class_RID>` region **)** |const| |
  186. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  187. | :ref:`float<class_float>` | :ref:`region_get_enter_cost<class_NavigationServer2D_method_region_get_enter_cost>` **(** :ref:`RID<class_RID>` region **)** |const| |
  188. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  189. | :ref:`RID<class_RID>` | :ref:`region_get_map<class_NavigationServer2D_method_region_get_map>` **(** :ref:`RID<class_RID>` region **)** |const| |
  190. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  191. | :ref:`int<class_int>` | :ref:`region_get_navigation_layers<class_NavigationServer2D_method_region_get_navigation_layers>` **(** :ref:`RID<class_RID>` region **)** |const| |
  192. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  193. | :ref:`int<class_int>` | :ref:`region_get_owner_id<class_NavigationServer2D_method_region_get_owner_id>` **(** :ref:`RID<class_RID>` region **)** |const| |
  194. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  195. | :ref:`float<class_float>` | :ref:`region_get_travel_cost<class_NavigationServer2D_method_region_get_travel_cost>` **(** :ref:`RID<class_RID>` region **)** |const| |
  196. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  197. | :ref:`bool<class_bool>` | :ref:`region_get_use_edge_connections<class_NavigationServer2D_method_region_get_use_edge_connections>` **(** :ref:`RID<class_RID>` region **)** |const| |
  198. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  199. | :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| |
  200. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  201. | void | :ref:`region_set_enter_cost<class_NavigationServer2D_method_region_set_enter_cost>` **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` enter_cost **)** |
  202. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  203. | void | :ref:`region_set_map<class_NavigationServer2D_method_region_set_map>` **(** :ref:`RID<class_RID>` region, :ref:`RID<class_RID>` map **)** |
  204. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  205. | void | :ref:`region_set_navigation_layers<class_NavigationServer2D_method_region_set_navigation_layers>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` navigation_layers **)** |
  206. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  207. | void | :ref:`region_set_navigation_polygon<class_NavigationServer2D_method_region_set_navigation_polygon>` **(** :ref:`RID<class_RID>` region, :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon **)** |
  208. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  209. | void | :ref:`region_set_owner_id<class_NavigationServer2D_method_region_set_owner_id>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` owner_id **)** |
  210. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  211. | void | :ref:`region_set_transform<class_NavigationServer2D_method_region_set_transform>` **(** :ref:`RID<class_RID>` region, :ref:`Transform2D<class_Transform2D>` transform **)** |
  212. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  213. | void | :ref:`region_set_travel_cost<class_NavigationServer2D_method_region_set_travel_cost>` **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` travel_cost **)** |
  214. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  215. | void | :ref:`region_set_use_edge_connections<class_NavigationServer2D_method_region_set_use_edge_connections>` **(** :ref:`RID<class_RID>` region, :ref:`bool<class_bool>` enabled **)** |
  216. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  217. | void | :ref:`set_debug_enabled<class_NavigationServer2D_method_set_debug_enabled>` **(** :ref:`bool<class_bool>` enabled **)** |
  218. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  219. .. rst-class:: classref-section-separator
  220. ----
  221. .. rst-class:: classref-descriptions-group
  222. Signals
  223. -------
  224. .. _class_NavigationServer2D_signal_map_changed:
  225. .. rst-class:: classref-signal
  226. **map_changed** **(** :ref:`RID<class_RID>` map **)**
  227. Emitted when a navigation map is updated, when a region moves or is modified.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_NavigationServer2D_signal_navigation_debug_changed:
  231. .. rst-class:: classref-signal
  232. **navigation_debug_changed** **(** **)**
  233. Emitted when navigation debug settings are changed. Only available in debug builds.
  234. .. rst-class:: classref-section-separator
  235. ----
  236. .. rst-class:: classref-descriptions-group
  237. Method Descriptions
  238. -------------------
  239. .. _class_NavigationServer2D_method_agent_create:
  240. .. rst-class:: classref-method
  241. :ref:`RID<class_RID>` **agent_create** **(** **)**
  242. Creates the agent.
  243. .. rst-class:: classref-item-separator
  244. ----
  245. .. _class_NavigationServer2D_method_agent_get_avoidance_enabled:
  246. .. rst-class:: classref-method
  247. :ref:`bool<class_bool>` **agent_get_avoidance_enabled** **(** :ref:`RID<class_RID>` agent **)** |const|
  248. Return ``true`` if the specified ``agent`` uses avoidance.
  249. .. rst-class:: classref-item-separator
  250. ----
  251. .. _class_NavigationServer2D_method_agent_get_map:
  252. .. rst-class:: classref-method
  253. :ref:`RID<class_RID>` **agent_get_map** **(** :ref:`RID<class_RID>` agent **)** |const|
  254. Returns the navigation map :ref:`RID<class_RID>` the requested ``agent`` is currently assigned to.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _class_NavigationServer2D_method_agent_get_paused:
  258. .. rst-class:: classref-method
  259. :ref:`bool<class_bool>` **agent_get_paused** **(** :ref:`RID<class_RID>` agent **)** |const|
  260. Returns ``true`` if the specified ``agent`` is paused.
  261. .. rst-class:: classref-item-separator
  262. ----
  263. .. _class_NavigationServer2D_method_agent_is_map_changed:
  264. .. rst-class:: classref-method
  265. :ref:`bool<class_bool>` **agent_is_map_changed** **(** :ref:`RID<class_RID>` agent **)** |const|
  266. Returns true if the map got changed the previous frame.
  267. .. rst-class:: classref-item-separator
  268. ----
  269. .. _class_NavigationServer2D_method_agent_set_avoidance_callback:
  270. .. rst-class:: classref-method
  271. void **agent_set_avoidance_callback** **(** :ref:`RID<class_RID>` agent, :ref:`Callable<class_Callable>` callback **)**
  272. Sets the callback :ref:`Callable<class_Callable>` that gets called after each avoidance processing step for the ``agent``. The calculated ``safe_velocity`` will be dispatched with a signal to the object just before the physics calculations.
  273. \ **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_avoidance_callback<class_NavigationServer2D_method_agent_set_avoidance_callback>` again with an empty :ref:`Callable<class_Callable>`.
  274. .. rst-class:: classref-item-separator
  275. ----
  276. .. _class_NavigationServer2D_method_agent_set_avoidance_enabled:
  277. .. rst-class:: classref-method
  278. void **agent_set_avoidance_enabled** **(** :ref:`RID<class_RID>` agent, :ref:`bool<class_bool>` enabled **)**
  279. If ``enabled`` is ``true`` the specified ``agent`` uses avoidance.
  280. .. rst-class:: classref-item-separator
  281. ----
  282. .. _class_NavigationServer2D_method_agent_set_avoidance_layers:
  283. .. rst-class:: classref-method
  284. void **agent_set_avoidance_layers** **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` layers **)**
  285. Set the agent's ``avoidance_layers`` bitmask.
  286. .. rst-class:: classref-item-separator
  287. ----
  288. .. _class_NavigationServer2D_method_agent_set_avoidance_mask:
  289. .. rst-class:: classref-method
  290. void **agent_set_avoidance_mask** **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` mask **)**
  291. Set the agent's ``avoidance_mask`` bitmask.
  292. .. rst-class:: classref-item-separator
  293. ----
  294. .. _class_NavigationServer2D_method_agent_set_avoidance_priority:
  295. .. rst-class:: classref-method
  296. void **agent_set_avoidance_priority** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` priority **)**
  297. Set the agent's ``avoidance_priority`` with a ``priority`` between 0.0 (lowest priority) to 1.0 (highest priority).
  298. The specified ``agent`` does not adjust the velocity for other agents that would match the ``avoidance_mask`` but have a lower `` avoidance_priority``. This in turn makes the other agents with lower priority adjust their velocities even more to avoid collision with this agent.
  299. .. rst-class:: classref-item-separator
  300. ----
  301. .. _class_NavigationServer2D_method_agent_set_map:
  302. .. rst-class:: classref-method
  303. void **agent_set_map** **(** :ref:`RID<class_RID>` agent, :ref:`RID<class_RID>` map **)**
  304. Puts the agent in the map.
  305. .. rst-class:: classref-item-separator
  306. ----
  307. .. _class_NavigationServer2D_method_agent_set_max_neighbors:
  308. .. rst-class:: classref-method
  309. void **agent_set_max_neighbors** **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` count **)**
  310. 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.
  311. .. rst-class:: classref-item-separator
  312. ----
  313. .. _class_NavigationServer2D_method_agent_set_max_speed:
  314. .. rst-class:: classref-method
  315. void **agent_set_max_speed** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` max_speed **)**
  316. Sets the maximum speed of the agent. Must be positive.
  317. .. rst-class:: classref-item-separator
  318. ----
  319. .. _class_NavigationServer2D_method_agent_set_neighbor_distance:
  320. .. rst-class:: classref-method
  321. void **agent_set_neighbor_distance** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` distance **)**
  322. 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.
  323. .. rst-class:: classref-item-separator
  324. ----
  325. .. _class_NavigationServer2D_method_agent_set_paused:
  326. .. rst-class:: classref-method
  327. void **agent_set_paused** **(** :ref:`RID<class_RID>` agent, :ref:`bool<class_bool>` paused **)**
  328. If ``paused`` is true the specified ``agent`` will not be processed, e.g. calculate avoidance velocities or receive avoidance callbacks.
  329. .. rst-class:: classref-item-separator
  330. ----
  331. .. _class_NavigationServer2D_method_agent_set_position:
  332. .. rst-class:: classref-method
  333. void **agent_set_position** **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` position **)**
  334. Sets the position of the agent in world space.
  335. .. rst-class:: classref-item-separator
  336. ----
  337. .. _class_NavigationServer2D_method_agent_set_radius:
  338. .. rst-class:: classref-method
  339. void **agent_set_radius** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` radius **)**
  340. Sets the radius of the agent.
  341. .. rst-class:: classref-item-separator
  342. ----
  343. .. _class_NavigationServer2D_method_agent_set_time_horizon_agents:
  344. .. rst-class:: classref-method
  345. void **agent_set_time_horizon_agents** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time_horizon **)**
  346. 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. A too high value will slow down agents movement considerably. Must be positive.
  347. .. rst-class:: classref-item-separator
  348. ----
  349. .. _class_NavigationServer2D_method_agent_set_time_horizon_obstacles:
  350. .. rst-class:: classref-method
  351. void **agent_set_time_horizon_obstacles** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time_horizon **)**
  352. The minimal amount of time for which the agent's velocities that are computed by the simulation are safe with respect to static avoidance obstacles. The larger this number, the sooner this agent will respond to the presence of static avoidance obstacles, but the less freedom this agent has in choosing its velocities. A too high value will slow down agents movement considerably. Must be positive.
  353. .. rst-class:: classref-item-separator
  354. ----
  355. .. _class_NavigationServer2D_method_agent_set_velocity:
  356. .. rst-class:: classref-method
  357. void **agent_set_velocity** **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)**
  358. Sets ``velocity`` as the new wanted velocity for the specified ``agent``. The avoidance simulation will try to fulfill this velocity if possible but will modify it to avoid collision with other agent's and obstacles. When an agent is teleported to a new position far away use :ref:`agent_set_velocity_forced<class_NavigationServer2D_method_agent_set_velocity_forced>` instead to reset the internal velocity state.
  359. .. rst-class:: classref-item-separator
  360. ----
  361. .. _class_NavigationServer2D_method_agent_set_velocity_forced:
  362. .. rst-class:: classref-method
  363. void **agent_set_velocity_forced** **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)**
  364. Replaces the internal velocity in the collision avoidance simulation with ``velocity`` for the specified ``agent``. When an agent is teleported to a new position far away this function should be used in the same frame. If called frequently this function can get agents stuck.
  365. .. rst-class:: classref-item-separator
  366. ----
  367. .. _class_NavigationServer2D_method_free_rid:
  368. .. rst-class:: classref-method
  369. void **free_rid** **(** :ref:`RID<class_RID>` rid **)**
  370. Destroys the given RID.
  371. .. rst-class:: classref-item-separator
  372. ----
  373. .. _class_NavigationServer2D_method_get_debug_enabled:
  374. .. rst-class:: classref-method
  375. :ref:`bool<class_bool>` **get_debug_enabled** **(** **)** |const|
  376. Returns ``true`` when the NavigationServer has debug enabled.
  377. .. rst-class:: classref-item-separator
  378. ----
  379. .. _class_NavigationServer2D_method_get_maps:
  380. .. rst-class:: classref-method
  381. :ref:`RID[]<class_RID>` **get_maps** **(** **)** |const|
  382. 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.
  383. .. rst-class:: classref-item-separator
  384. ----
  385. .. _class_NavigationServer2D_method_link_create:
  386. .. rst-class:: classref-method
  387. :ref:`RID<class_RID>` **link_create** **(** **)**
  388. Create a new link between two positions on a map.
  389. .. rst-class:: classref-item-separator
  390. ----
  391. .. _class_NavigationServer2D_method_link_get_end_position:
  392. .. rst-class:: classref-method
  393. :ref:`Vector2<class_Vector2>` **link_get_end_position** **(** :ref:`RID<class_RID>` link **)** |const|
  394. Returns the ending position of this ``link``.
  395. .. rst-class:: classref-item-separator
  396. ----
  397. .. _class_NavigationServer2D_method_link_get_enter_cost:
  398. .. rst-class:: classref-method
  399. :ref:`float<class_float>` **link_get_enter_cost** **(** :ref:`RID<class_RID>` link **)** |const|
  400. Returns the enter cost of this ``link``.
  401. .. rst-class:: classref-item-separator
  402. ----
  403. .. _class_NavigationServer2D_method_link_get_map:
  404. .. rst-class:: classref-method
  405. :ref:`RID<class_RID>` **link_get_map** **(** :ref:`RID<class_RID>` link **)** |const|
  406. Returns the navigation map :ref:`RID<class_RID>` the requested ``link`` is currently assigned to.
  407. .. rst-class:: classref-item-separator
  408. ----
  409. .. _class_NavigationServer2D_method_link_get_navigation_layers:
  410. .. rst-class:: classref-method
  411. :ref:`int<class_int>` **link_get_navigation_layers** **(** :ref:`RID<class_RID>` link **)** |const|
  412. Returns the navigation layers for this ``link``.
  413. .. rst-class:: classref-item-separator
  414. ----
  415. .. _class_NavigationServer2D_method_link_get_owner_id:
  416. .. rst-class:: classref-method
  417. :ref:`int<class_int>` **link_get_owner_id** **(** :ref:`RID<class_RID>` link **)** |const|
  418. Returns the ``ObjectID`` of the object which manages this link.
  419. .. rst-class:: classref-item-separator
  420. ----
  421. .. _class_NavigationServer2D_method_link_get_start_position:
  422. .. rst-class:: classref-method
  423. :ref:`Vector2<class_Vector2>` **link_get_start_position** **(** :ref:`RID<class_RID>` link **)** |const|
  424. Returns the starting position of this ``link``.
  425. .. rst-class:: classref-item-separator
  426. ----
  427. .. _class_NavigationServer2D_method_link_get_travel_cost:
  428. .. rst-class:: classref-method
  429. :ref:`float<class_float>` **link_get_travel_cost** **(** :ref:`RID<class_RID>` link **)** |const|
  430. Returns the travel cost of this ``link``.
  431. .. rst-class:: classref-item-separator
  432. ----
  433. .. _class_NavigationServer2D_method_link_is_bidirectional:
  434. .. rst-class:: classref-method
  435. :ref:`bool<class_bool>` **link_is_bidirectional** **(** :ref:`RID<class_RID>` link **)** |const|
  436. Returns whether this ``link`` can be travelled in both directions.
  437. .. rst-class:: classref-item-separator
  438. ----
  439. .. _class_NavigationServer2D_method_link_set_bidirectional:
  440. .. rst-class:: classref-method
  441. void **link_set_bidirectional** **(** :ref:`RID<class_RID>` link, :ref:`bool<class_bool>` bidirectional **)**
  442. Sets whether this ``link`` can be travelled in both directions.
  443. .. rst-class:: classref-item-separator
  444. ----
  445. .. _class_NavigationServer2D_method_link_set_end_position:
  446. .. rst-class:: classref-method
  447. void **link_set_end_position** **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)**
  448. Sets the exit position for the ``link``.
  449. .. rst-class:: classref-item-separator
  450. ----
  451. .. _class_NavigationServer2D_method_link_set_enter_cost:
  452. .. rst-class:: classref-method
  453. void **link_set_enter_cost** **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` enter_cost **)**
  454. Sets the ``enter_cost`` for this ``link``.
  455. .. rst-class:: classref-item-separator
  456. ----
  457. .. _class_NavigationServer2D_method_link_set_map:
  458. .. rst-class:: classref-method
  459. void **link_set_map** **(** :ref:`RID<class_RID>` link, :ref:`RID<class_RID>` map **)**
  460. Sets the navigation map :ref:`RID<class_RID>` for the link.
  461. .. rst-class:: classref-item-separator
  462. ----
  463. .. _class_NavigationServer2D_method_link_set_navigation_layers:
  464. .. rst-class:: classref-method
  465. void **link_set_navigation_layers** **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` navigation_layers **)**
  466. Set the links's navigation layers. This allows selecting links from a path request (when using :ref:`map_get_path<class_NavigationServer2D_method_map_get_path>`).
  467. .. rst-class:: classref-item-separator
  468. ----
  469. .. _class_NavigationServer2D_method_link_set_owner_id:
  470. .. rst-class:: classref-method
  471. void **link_set_owner_id** **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` owner_id **)**
  472. Set the ``ObjectID`` of the object which manages this link.
  473. .. rst-class:: classref-item-separator
  474. ----
  475. .. _class_NavigationServer2D_method_link_set_start_position:
  476. .. rst-class:: classref-method
  477. void **link_set_start_position** **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)**
  478. Sets the entry position for this ``link``.
  479. .. rst-class:: classref-item-separator
  480. ----
  481. .. _class_NavigationServer2D_method_link_set_travel_cost:
  482. .. rst-class:: classref-method
  483. void **link_set_travel_cost** **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` travel_cost **)**
  484. Sets the ``travel_cost`` for this ``link``.
  485. .. rst-class:: classref-item-separator
  486. ----
  487. .. _class_NavigationServer2D_method_map_create:
  488. .. rst-class:: classref-method
  489. :ref:`RID<class_RID>` **map_create** **(** **)**
  490. Create a new map.
  491. .. rst-class:: classref-item-separator
  492. ----
  493. .. _class_NavigationServer2D_method_map_force_update:
  494. .. rst-class:: classref-method
  495. void **map_force_update** **(** :ref:`RID<class_RID>` map **)**
  496. 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).
  497. 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.
  498. 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.
  499. \ **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.
  500. .. rst-class:: classref-item-separator
  501. ----
  502. .. _class_NavigationServer2D_method_map_get_agents:
  503. .. rst-class:: classref-method
  504. :ref:`RID[]<class_RID>` **map_get_agents** **(** :ref:`RID<class_RID>` map **)** |const|
  505. Returns all navigation agents :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  506. .. rst-class:: classref-item-separator
  507. ----
  508. .. _class_NavigationServer2D_method_map_get_cell_size:
  509. .. rst-class:: classref-method
  510. :ref:`float<class_float>` **map_get_cell_size** **(** :ref:`RID<class_RID>` map **)** |const|
  511. Returns the map cell size used to rasterize the navigation mesh vertices.
  512. .. rst-class:: classref-item-separator
  513. ----
  514. .. _class_NavigationServer2D_method_map_get_closest_point:
  515. .. rst-class:: classref-method
  516. :ref:`Vector2<class_Vector2>` **map_get_closest_point** **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` to_point **)** |const|
  517. Returns the point closest to the provided ``to_point`` on the navigation mesh surface.
  518. .. rst-class:: classref-item-separator
  519. ----
  520. .. _class_NavigationServer2D_method_map_get_closest_point_owner:
  521. .. rst-class:: classref-method
  522. :ref:`RID<class_RID>` **map_get_closest_point_owner** **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` to_point **)** |const|
  523. Returns the owner region RID for the point returned by :ref:`map_get_closest_point<class_NavigationServer2D_method_map_get_closest_point>`.
  524. .. rst-class:: classref-item-separator
  525. ----
  526. .. _class_NavigationServer2D_method_map_get_edge_connection_margin:
  527. .. rst-class:: classref-method
  528. :ref:`float<class_float>` **map_get_edge_connection_margin** **(** :ref:`RID<class_RID>` map **)** |const|
  529. Returns the edge connection margin of the map. The edge connection margin is a distance used to connect two regions.
  530. .. rst-class:: classref-item-separator
  531. ----
  532. .. _class_NavigationServer2D_method_map_get_link_connection_radius:
  533. .. rst-class:: classref-method
  534. :ref:`float<class_float>` **map_get_link_connection_radius** **(** :ref:`RID<class_RID>` map **)** |const|
  535. Returns the link connection radius of the map. This distance is the maximum range any link will search for navigation mesh polygons to connect to.
  536. .. rst-class:: classref-item-separator
  537. ----
  538. .. _class_NavigationServer2D_method_map_get_links:
  539. .. rst-class:: classref-method
  540. :ref:`RID[]<class_RID>` **map_get_links** **(** :ref:`RID<class_RID>` map **)** |const|
  541. Returns all navigation link :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  542. .. rst-class:: classref-item-separator
  543. ----
  544. .. _class_NavigationServer2D_method_map_get_obstacles:
  545. .. rst-class:: classref-method
  546. :ref:`RID[]<class_RID>` **map_get_obstacles** **(** :ref:`RID<class_RID>` map **)** |const|
  547. Returns all navigation obstacle :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  548. .. rst-class:: classref-item-separator
  549. ----
  550. .. _class_NavigationServer2D_method_map_get_path:
  551. .. rst-class:: classref-method
  552. :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|
  553. 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.
  554. .. rst-class:: classref-item-separator
  555. ----
  556. .. _class_NavigationServer2D_method_map_get_regions:
  557. .. rst-class:: classref-method
  558. :ref:`RID[]<class_RID>` **map_get_regions** **(** :ref:`RID<class_RID>` map **)** |const|
  559. Returns all navigation regions :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  560. .. rst-class:: classref-item-separator
  561. ----
  562. .. _class_NavigationServer2D_method_map_get_use_edge_connections:
  563. .. rst-class:: classref-method
  564. :ref:`bool<class_bool>` **map_get_use_edge_connections** **(** :ref:`RID<class_RID>` map **)** |const|
  565. Returns whether the navigation ``map`` allows navigation regions to use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
  566. .. rst-class:: classref-item-separator
  567. ----
  568. .. _class_NavigationServer2D_method_map_is_active:
  569. .. rst-class:: classref-method
  570. :ref:`bool<class_bool>` **map_is_active** **(** :ref:`RID<class_RID>` map **)** |const|
  571. Returns true if the map is active.
  572. .. rst-class:: classref-item-separator
  573. ----
  574. .. _class_NavigationServer2D_method_map_set_active:
  575. .. rst-class:: classref-method
  576. void **map_set_active** **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` active **)**
  577. Sets the map active.
  578. .. rst-class:: classref-item-separator
  579. ----
  580. .. _class_NavigationServer2D_method_map_set_cell_size:
  581. .. rst-class:: classref-method
  582. void **map_set_cell_size** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` cell_size **)**
  583. Sets the map cell size used to rasterize the navigation mesh vertices. Must match with the cell size of the used navigation meshes.
  584. .. rst-class:: classref-item-separator
  585. ----
  586. .. _class_NavigationServer2D_method_map_set_edge_connection_margin:
  587. .. rst-class:: classref-method
  588. void **map_set_edge_connection_margin** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` margin **)**
  589. Set the map edge connection margin used to weld the compatible region edges.
  590. .. rst-class:: classref-item-separator
  591. ----
  592. .. _class_NavigationServer2D_method_map_set_link_connection_radius:
  593. .. rst-class:: classref-method
  594. void **map_set_link_connection_radius** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` radius **)**
  595. Set the map's link connection radius used to connect links to navigation polygons.
  596. .. rst-class:: classref-item-separator
  597. ----
  598. .. _class_NavigationServer2D_method_map_set_use_edge_connections:
  599. .. rst-class:: classref-method
  600. void **map_set_use_edge_connections** **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` enabled **)**
  601. Set the navigation ``map`` edge connection use. If ``enabled`` the navigation map allows navigation regions to use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
  602. .. rst-class:: classref-item-separator
  603. ----
  604. .. _class_NavigationServer2D_method_obstacle_create:
  605. .. rst-class:: classref-method
  606. :ref:`RID<class_RID>` **obstacle_create** **(** **)**
  607. Creates a new navigation obstacle.
  608. .. rst-class:: classref-item-separator
  609. ----
  610. .. _class_NavigationServer2D_method_obstacle_get_avoidance_enabled:
  611. .. rst-class:: classref-method
  612. :ref:`bool<class_bool>` **obstacle_get_avoidance_enabled** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  613. Returns ``true`` if the provided ``obstacle`` has avoidance enabled.
  614. .. rst-class:: classref-item-separator
  615. ----
  616. .. _class_NavigationServer2D_method_obstacle_get_map:
  617. .. rst-class:: classref-method
  618. :ref:`RID<class_RID>` **obstacle_get_map** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  619. Returns the navigation map :ref:`RID<class_RID>` the requested ``obstacle`` is currently assigned to.
  620. .. rst-class:: classref-item-separator
  621. ----
  622. .. _class_NavigationServer2D_method_obstacle_get_paused:
  623. .. rst-class:: classref-method
  624. :ref:`bool<class_bool>` **obstacle_get_paused** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  625. Returns ``true`` if the specified ``obstacle`` is paused.
  626. .. rst-class:: classref-item-separator
  627. ----
  628. .. _class_NavigationServer2D_method_obstacle_set_avoidance_enabled:
  629. .. rst-class:: classref-method
  630. void **obstacle_set_avoidance_enabled** **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` enabled **)**
  631. If ``enabled`` the provided ``obstacle`` affects avoidance using agents.
  632. .. rst-class:: classref-item-separator
  633. ----
  634. .. _class_NavigationServer2D_method_obstacle_set_avoidance_layers:
  635. .. rst-class:: classref-method
  636. void **obstacle_set_avoidance_layers** **(** :ref:`RID<class_RID>` obstacle, :ref:`int<class_int>` layers **)**
  637. Set the obstacles's ``avoidance_layers`` bitmask.
  638. .. rst-class:: classref-item-separator
  639. ----
  640. .. _class_NavigationServer2D_method_obstacle_set_map:
  641. .. rst-class:: classref-method
  642. void **obstacle_set_map** **(** :ref:`RID<class_RID>` obstacle, :ref:`RID<class_RID>` map **)**
  643. Sets the navigation map :ref:`RID<class_RID>` for the obstacle.
  644. .. rst-class:: classref-item-separator
  645. ----
  646. .. _class_NavigationServer2D_method_obstacle_set_paused:
  647. .. rst-class:: classref-method
  648. void **obstacle_set_paused** **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` paused **)**
  649. If ``paused`` is true the specified ``obstacle`` will not be processed, e.g. affect avoidance velocities.
  650. .. rst-class:: classref-item-separator
  651. ----
  652. .. _class_NavigationServer2D_method_obstacle_set_position:
  653. .. rst-class:: classref-method
  654. void **obstacle_set_position** **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` position **)**
  655. Sets the position of the obstacle in world space.
  656. .. rst-class:: classref-item-separator
  657. ----
  658. .. _class_NavigationServer2D_method_obstacle_set_radius:
  659. .. rst-class:: classref-method
  660. void **obstacle_set_radius** **(** :ref:`RID<class_RID>` obstacle, :ref:`float<class_float>` radius **)**
  661. Sets the radius of the dynamic obstacle.
  662. .. rst-class:: classref-item-separator
  663. ----
  664. .. _class_NavigationServer2D_method_obstacle_set_velocity:
  665. .. rst-class:: classref-method
  666. void **obstacle_set_velocity** **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` velocity **)**
  667. Sets ``velocity`` of the dynamic ``obstacle``. Allows other agents to better predict the movement of the dynamic obstacle. Only works in combination with the radius of the obstacle.
  668. .. rst-class:: classref-item-separator
  669. ----
  670. .. _class_NavigationServer2D_method_obstacle_set_vertices:
  671. .. rst-class:: classref-method
  672. void **obstacle_set_vertices** **(** :ref:`RID<class_RID>` obstacle, :ref:`PackedVector2Array<class_PackedVector2Array>` vertices **)**
  673. Sets the outline vertices for the obstacle. If the vertices are winded in clockwise order agents will be pushed in by the obstacle, else they will be pushed out.
  674. .. rst-class:: classref-item-separator
  675. ----
  676. .. _class_NavigationServer2D_method_query_path:
  677. .. rst-class:: classref-method
  678. void **query_path** **(** :ref:`NavigationPathQueryParameters2D<class_NavigationPathQueryParameters2D>` parameters, :ref:`NavigationPathQueryResult2D<class_NavigationPathQueryResult2D>` result **)** |const|
  679. Queries a path in a given navigation map. Start and target position and other parameters are defined through :ref:`NavigationPathQueryParameters2D<class_NavigationPathQueryParameters2D>`. Updates the provided :ref:`NavigationPathQueryResult2D<class_NavigationPathQueryResult2D>` result object with the path among other results requested by the query.
  680. .. rst-class:: classref-item-separator
  681. ----
  682. .. _class_NavigationServer2D_method_region_create:
  683. .. rst-class:: classref-method
  684. :ref:`RID<class_RID>` **region_create** **(** **)**
  685. Creates a new region.
  686. .. rst-class:: classref-item-separator
  687. ----
  688. .. _class_NavigationServer2D_method_region_get_connection_pathway_end:
  689. .. rst-class:: classref-method
  690. :ref:`Vector2<class_Vector2>` **region_get_connection_pathway_end** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` connection **)** |const|
  691. Returns the ending point of a connection door. ``connection`` is an index between 0 and the return value of :ref:`region_get_connections_count<class_NavigationServer2D_method_region_get_connections_count>`.
  692. .. rst-class:: classref-item-separator
  693. ----
  694. .. _class_NavigationServer2D_method_region_get_connection_pathway_start:
  695. .. rst-class:: classref-method
  696. :ref:`Vector2<class_Vector2>` **region_get_connection_pathway_start** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` connection **)** |const|
  697. Returns the starting point of a connection door. ``connection`` is an index between 0 and the return value of :ref:`region_get_connections_count<class_NavigationServer2D_method_region_get_connections_count>`.
  698. .. rst-class:: classref-item-separator
  699. ----
  700. .. _class_NavigationServer2D_method_region_get_connections_count:
  701. .. rst-class:: classref-method
  702. :ref:`int<class_int>` **region_get_connections_count** **(** :ref:`RID<class_RID>` region **)** |const|
  703. Returns how many connections this ``region`` has with other regions in the map.
  704. .. rst-class:: classref-item-separator
  705. ----
  706. .. _class_NavigationServer2D_method_region_get_enter_cost:
  707. .. rst-class:: classref-method
  708. :ref:`float<class_float>` **region_get_enter_cost** **(** :ref:`RID<class_RID>` region **)** |const|
  709. Returns the enter cost of this ``region``.
  710. .. rst-class:: classref-item-separator
  711. ----
  712. .. _class_NavigationServer2D_method_region_get_map:
  713. .. rst-class:: classref-method
  714. :ref:`RID<class_RID>` **region_get_map** **(** :ref:`RID<class_RID>` region **)** |const|
  715. Returns the navigation map :ref:`RID<class_RID>` the requested ``region`` is currently assigned to.
  716. .. rst-class:: classref-item-separator
  717. ----
  718. .. _class_NavigationServer2D_method_region_get_navigation_layers:
  719. .. rst-class:: classref-method
  720. :ref:`int<class_int>` **region_get_navigation_layers** **(** :ref:`RID<class_RID>` region **)** |const|
  721. Returns the region's navigation layers.
  722. .. rst-class:: classref-item-separator
  723. ----
  724. .. _class_NavigationServer2D_method_region_get_owner_id:
  725. .. rst-class:: classref-method
  726. :ref:`int<class_int>` **region_get_owner_id** **(** :ref:`RID<class_RID>` region **)** |const|
  727. Returns the ``ObjectID`` of the object which manages this region.
  728. .. rst-class:: classref-item-separator
  729. ----
  730. .. _class_NavigationServer2D_method_region_get_travel_cost:
  731. .. rst-class:: classref-method
  732. :ref:`float<class_float>` **region_get_travel_cost** **(** :ref:`RID<class_RID>` region **)** |const|
  733. Returns the travel cost of this ``region``.
  734. .. rst-class:: classref-item-separator
  735. ----
  736. .. _class_NavigationServer2D_method_region_get_use_edge_connections:
  737. .. rst-class:: classref-method
  738. :ref:`bool<class_bool>` **region_get_use_edge_connections** **(** :ref:`RID<class_RID>` region **)** |const|
  739. Returns whether the navigation ``region`` is set to use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
  740. .. rst-class:: classref-item-separator
  741. ----
  742. .. _class_NavigationServer2D_method_region_owns_point:
  743. .. rst-class:: classref-method
  744. :ref:`bool<class_bool>` **region_owns_point** **(** :ref:`RID<class_RID>` region, :ref:`Vector2<class_Vector2>` point **)** |const|
  745. 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.
  746. 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.
  747. \ **Note:** If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected.
  748. .. rst-class:: classref-item-separator
  749. ----
  750. .. _class_NavigationServer2D_method_region_set_enter_cost:
  751. .. rst-class:: classref-method
  752. void **region_set_enter_cost** **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` enter_cost **)**
  753. Sets the ``enter_cost`` for this ``region``.
  754. .. rst-class:: classref-item-separator
  755. ----
  756. .. _class_NavigationServer2D_method_region_set_map:
  757. .. rst-class:: classref-method
  758. void **region_set_map** **(** :ref:`RID<class_RID>` region, :ref:`RID<class_RID>` map **)**
  759. Sets the map for the region.
  760. .. rst-class:: classref-item-separator
  761. ----
  762. .. _class_NavigationServer2D_method_region_set_navigation_layers:
  763. .. rst-class:: classref-method
  764. void **region_set_navigation_layers** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` navigation_layers **)**
  765. 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>`).
  766. .. rst-class:: classref-item-separator
  767. ----
  768. .. _class_NavigationServer2D_method_region_set_navigation_polygon:
  769. .. rst-class:: classref-method
  770. void **region_set_navigation_polygon** **(** :ref:`RID<class_RID>` region, :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon **)**
  771. Sets the ``navigation_polygon`` for the region.
  772. .. rst-class:: classref-item-separator
  773. ----
  774. .. _class_NavigationServer2D_method_region_set_owner_id:
  775. .. rst-class:: classref-method
  776. void **region_set_owner_id** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` owner_id **)**
  777. Set the ``ObjectID`` of the object which manages this region.
  778. .. rst-class:: classref-item-separator
  779. ----
  780. .. _class_NavigationServer2D_method_region_set_transform:
  781. .. rst-class:: classref-method
  782. void **region_set_transform** **(** :ref:`RID<class_RID>` region, :ref:`Transform2D<class_Transform2D>` transform **)**
  783. Sets the global transformation for the region.
  784. .. rst-class:: classref-item-separator
  785. ----
  786. .. _class_NavigationServer2D_method_region_set_travel_cost:
  787. .. rst-class:: classref-method
  788. void **region_set_travel_cost** **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` travel_cost **)**
  789. Sets the ``travel_cost`` for this ``region``.
  790. .. rst-class:: classref-item-separator
  791. ----
  792. .. _class_NavigationServer2D_method_region_set_use_edge_connections:
  793. .. rst-class:: classref-method
  794. void **region_set_use_edge_connections** **(** :ref:`RID<class_RID>` region, :ref:`bool<class_bool>` enabled **)**
  795. If ``enabled`` the navigation ``region`` will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
  796. .. rst-class:: classref-item-separator
  797. ----
  798. .. _class_NavigationServer2D_method_set_debug_enabled:
  799. .. rst-class:: classref-method
  800. void **set_debug_enabled** **(** :ref:`bool<class_bool>` enabled **)**
  801. If ``true`` enables debug mode on the NavigationServer.
  802. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  803. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  804. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  805. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  806. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  807. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  808. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`