class_navigationserver2d.rst 127 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515
  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.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/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:`bake_from_source_geometry_data<class_NavigationServer2D_method_bake_from_source_geometry_data>` **(** :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon, :ref:`NavigationMeshSourceGeometryData2D<class_NavigationMeshSourceGeometryData2D>` source_geometry_data, :ref:`Callable<class_Callable>` callback=Callable() **)** |
  76. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`bake_from_source_geometry_data_async<class_NavigationServer2D_method_bake_from_source_geometry_data_async>` **(** :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon, :ref:`NavigationMeshSourceGeometryData2D<class_NavigationMeshSourceGeometryData2D>` source_geometry_data, :ref:`Callable<class_Callable>` callback=Callable() **)** |
  78. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`free_rid<class_NavigationServer2D_method_free_rid>` **(** :ref:`RID<class_RID>` rid **)** |
  80. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`bool<class_bool>` | :ref:`get_debug_enabled<class_NavigationServer2D_method_get_debug_enabled>` **(** **)** |const| |
  82. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`RID[]<class_RID>` | :ref:`get_maps<class_NavigationServer2D_method_get_maps>` **(** **)** |const| |
  84. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`RID<class_RID>` | :ref:`link_create<class_NavigationServer2D_method_link_create>` **(** **)** |
  86. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`bool<class_bool>` | :ref:`link_get_enabled<class_NavigationServer2D_method_link_get_enabled>` **(** :ref:`RID<class_RID>` link **)** |const| |
  88. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`Vector2<class_Vector2>` | :ref:`link_get_end_position<class_NavigationServer2D_method_link_get_end_position>` **(** :ref:`RID<class_RID>` link **)** |const| |
  90. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`float<class_float>` | :ref:`link_get_enter_cost<class_NavigationServer2D_method_link_get_enter_cost>` **(** :ref:`RID<class_RID>` link **)** |const| |
  92. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`RID<class_RID>` | :ref:`link_get_map<class_NavigationServer2D_method_link_get_map>` **(** :ref:`RID<class_RID>` link **)** |const| |
  94. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`int<class_int>` | :ref:`link_get_navigation_layers<class_NavigationServer2D_method_link_get_navigation_layers>` **(** :ref:`RID<class_RID>` link **)** |const| |
  96. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`int<class_int>` | :ref:`link_get_owner_id<class_NavigationServer2D_method_link_get_owner_id>` **(** :ref:`RID<class_RID>` link **)** |const| |
  98. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`Vector2<class_Vector2>` | :ref:`link_get_start_position<class_NavigationServer2D_method_link_get_start_position>` **(** :ref:`RID<class_RID>` link **)** |const| |
  100. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`float<class_float>` | :ref:`link_get_travel_cost<class_NavigationServer2D_method_link_get_travel_cost>` **(** :ref:`RID<class_RID>` link **)** |const| |
  102. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`bool<class_bool>` | :ref:`link_is_bidirectional<class_NavigationServer2D_method_link_is_bidirectional>` **(** :ref:`RID<class_RID>` link **)** |const| |
  104. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | void | :ref:`link_set_bidirectional<class_NavigationServer2D_method_link_set_bidirectional>` **(** :ref:`RID<class_RID>` link, :ref:`bool<class_bool>` bidirectional **)** |
  106. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | void | :ref:`link_set_enabled<class_NavigationServer2D_method_link_set_enabled>` **(** :ref:`RID<class_RID>` link, :ref:`bool<class_bool>` enabled **)** |
  108. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | void | :ref:`link_set_end_position<class_NavigationServer2D_method_link_set_end_position>` **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)** |
  110. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | void | :ref:`link_set_enter_cost<class_NavigationServer2D_method_link_set_enter_cost>` **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` enter_cost **)** |
  112. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | void | :ref:`link_set_map<class_NavigationServer2D_method_link_set_map>` **(** :ref:`RID<class_RID>` link, :ref:`RID<class_RID>` map **)** |
  114. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | void | :ref:`link_set_navigation_layers<class_NavigationServer2D_method_link_set_navigation_layers>` **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` navigation_layers **)** |
  116. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | void | :ref:`link_set_owner_id<class_NavigationServer2D_method_link_set_owner_id>` **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` owner_id **)** |
  118. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | void | :ref:`link_set_start_position<class_NavigationServer2D_method_link_set_start_position>` **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)** |
  120. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | void | :ref:`link_set_travel_cost<class_NavigationServer2D_method_link_set_travel_cost>` **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` travel_cost **)** |
  122. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | :ref:`RID<class_RID>` | :ref:`map_create<class_NavigationServer2D_method_map_create>` **(** **)** |
  124. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | void | :ref:`map_force_update<class_NavigationServer2D_method_map_force_update>` **(** :ref:`RID<class_RID>` map **)** |
  126. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`RID[]<class_RID>` | :ref:`map_get_agents<class_NavigationServer2D_method_map_get_agents>` **(** :ref:`RID<class_RID>` map **)** |const| |
  128. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`float<class_float>` | :ref:`map_get_cell_size<class_NavigationServer2D_method_map_get_cell_size>` **(** :ref:`RID<class_RID>` map **)** |const| |
  130. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | :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| |
  132. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | :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| |
  134. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | :ref:`float<class_float>` | :ref:`map_get_edge_connection_margin<class_NavigationServer2D_method_map_get_edge_connection_margin>` **(** :ref:`RID<class_RID>` map **)** |const| |
  136. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | :ref:`float<class_float>` | :ref:`map_get_link_connection_radius<class_NavigationServer2D_method_map_get_link_connection_radius>` **(** :ref:`RID<class_RID>` map **)** |const| |
  138. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | :ref:`RID[]<class_RID>` | :ref:`map_get_links<class_NavigationServer2D_method_map_get_links>` **(** :ref:`RID<class_RID>` map **)** |const| |
  140. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | :ref:`RID[]<class_RID>` | :ref:`map_get_obstacles<class_NavigationServer2D_method_map_get_obstacles>` **(** :ref:`RID<class_RID>` map **)** |const| |
  142. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | :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| |
  144. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | :ref:`RID[]<class_RID>` | :ref:`map_get_regions<class_NavigationServer2D_method_map_get_regions>` **(** :ref:`RID<class_RID>` map **)** |const| |
  146. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | :ref:`bool<class_bool>` | :ref:`map_get_use_edge_connections<class_NavigationServer2D_method_map_get_use_edge_connections>` **(** :ref:`RID<class_RID>` map **)** |const| |
  148. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | :ref:`bool<class_bool>` | :ref:`map_is_active<class_NavigationServer2D_method_map_is_active>` **(** :ref:`RID<class_RID>` map **)** |const| |
  150. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | void | :ref:`map_set_active<class_NavigationServer2D_method_map_set_active>` **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` active **)** |
  152. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. | void | :ref:`map_set_cell_size<class_NavigationServer2D_method_map_set_cell_size>` **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` cell_size **)** |
  154. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  155. | 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 **)** |
  156. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  157. | 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 **)** |
  158. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  159. | 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 **)** |
  160. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  161. | :ref:`RID<class_RID>` | :ref:`obstacle_create<class_NavigationServer2D_method_obstacle_create>` **(** **)** |
  162. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  163. | :ref:`bool<class_bool>` | :ref:`obstacle_get_avoidance_enabled<class_NavigationServer2D_method_obstacle_get_avoidance_enabled>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  164. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  165. | :ref:`RID<class_RID>` | :ref:`obstacle_get_map<class_NavigationServer2D_method_obstacle_get_map>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  166. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  167. | :ref:`bool<class_bool>` | :ref:`obstacle_get_paused<class_NavigationServer2D_method_obstacle_get_paused>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  168. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  169. | void | :ref:`obstacle_set_avoidance_enabled<class_NavigationServer2D_method_obstacle_set_avoidance_enabled>` **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` enabled **)** |
  170. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  171. | void | :ref:`obstacle_set_avoidance_layers<class_NavigationServer2D_method_obstacle_set_avoidance_layers>` **(** :ref:`RID<class_RID>` obstacle, :ref:`int<class_int>` layers **)** |
  172. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  173. | void | :ref:`obstacle_set_map<class_NavigationServer2D_method_obstacle_set_map>` **(** :ref:`RID<class_RID>` obstacle, :ref:`RID<class_RID>` map **)** |
  174. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  175. | void | :ref:`obstacle_set_paused<class_NavigationServer2D_method_obstacle_set_paused>` **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` paused **)** |
  176. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  177. | void | :ref:`obstacle_set_position<class_NavigationServer2D_method_obstacle_set_position>` **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` position **)** |
  178. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  179. | void | :ref:`obstacle_set_radius<class_NavigationServer2D_method_obstacle_set_radius>` **(** :ref:`RID<class_RID>` obstacle, :ref:`float<class_float>` radius **)** |
  180. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  181. | void | :ref:`obstacle_set_velocity<class_NavigationServer2D_method_obstacle_set_velocity>` **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` velocity **)** |
  182. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  183. | void | :ref:`obstacle_set_vertices<class_NavigationServer2D_method_obstacle_set_vertices>` **(** :ref:`RID<class_RID>` obstacle, :ref:`PackedVector2Array<class_PackedVector2Array>` vertices **)** |
  184. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  185. | void | :ref:`parse_source_geometry_data<class_NavigationServer2D_method_parse_source_geometry_data>` **(** :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon, :ref:`NavigationMeshSourceGeometryData2D<class_NavigationMeshSourceGeometryData2D>` source_geometry_data, :ref:`Node<class_Node>` root_node, :ref:`Callable<class_Callable>` callback=Callable() **)** |
  186. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  187. | void | :ref:`query_path<class_NavigationServer2D_method_query_path>` **(** :ref:`NavigationPathQueryParameters2D<class_NavigationPathQueryParameters2D>` parameters, :ref:`NavigationPathQueryResult2D<class_NavigationPathQueryResult2D>` result **)** |const| |
  188. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  189. | :ref:`RID<class_RID>` | :ref:`region_create<class_NavigationServer2D_method_region_create>` **(** **)** |
  190. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  191. | :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| |
  192. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  193. | :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| |
  194. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  195. | :ref:`int<class_int>` | :ref:`region_get_connections_count<class_NavigationServer2D_method_region_get_connections_count>` **(** :ref:`RID<class_RID>` region **)** |const| |
  196. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  197. | :ref:`bool<class_bool>` | :ref:`region_get_enabled<class_NavigationServer2D_method_region_get_enabled>` **(** :ref:`RID<class_RID>` region **)** |const| |
  198. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  199. | :ref:`float<class_float>` | :ref:`region_get_enter_cost<class_NavigationServer2D_method_region_get_enter_cost>` **(** :ref:`RID<class_RID>` region **)** |const| |
  200. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  201. | :ref:`RID<class_RID>` | :ref:`region_get_map<class_NavigationServer2D_method_region_get_map>` **(** :ref:`RID<class_RID>` region **)** |const| |
  202. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  203. | :ref:`int<class_int>` | :ref:`region_get_navigation_layers<class_NavigationServer2D_method_region_get_navigation_layers>` **(** :ref:`RID<class_RID>` region **)** |const| |
  204. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  205. | :ref:`int<class_int>` | :ref:`region_get_owner_id<class_NavigationServer2D_method_region_get_owner_id>` **(** :ref:`RID<class_RID>` region **)** |const| |
  206. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  207. | :ref:`float<class_float>` | :ref:`region_get_travel_cost<class_NavigationServer2D_method_region_get_travel_cost>` **(** :ref:`RID<class_RID>` region **)** |const| |
  208. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  209. | :ref:`bool<class_bool>` | :ref:`region_get_use_edge_connections<class_NavigationServer2D_method_region_get_use_edge_connections>` **(** :ref:`RID<class_RID>` region **)** |const| |
  210. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  211. | :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| |
  212. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  213. | void | :ref:`region_set_enabled<class_NavigationServer2D_method_region_set_enabled>` **(** :ref:`RID<class_RID>` region, :ref:`bool<class_bool>` enabled **)** |
  214. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  215. | void | :ref:`region_set_enter_cost<class_NavigationServer2D_method_region_set_enter_cost>` **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` enter_cost **)** |
  216. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  217. | void | :ref:`region_set_map<class_NavigationServer2D_method_region_set_map>` **(** :ref:`RID<class_RID>` region, :ref:`RID<class_RID>` map **)** |
  218. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  219. | void | :ref:`region_set_navigation_layers<class_NavigationServer2D_method_region_set_navigation_layers>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` navigation_layers **)** |
  220. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  221. | void | :ref:`region_set_navigation_polygon<class_NavigationServer2D_method_region_set_navigation_polygon>` **(** :ref:`RID<class_RID>` region, :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon **)** |
  222. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  223. | void | :ref:`region_set_owner_id<class_NavigationServer2D_method_region_set_owner_id>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` owner_id **)** |
  224. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  225. | void | :ref:`region_set_transform<class_NavigationServer2D_method_region_set_transform>` **(** :ref:`RID<class_RID>` region, :ref:`Transform2D<class_Transform2D>` transform **)** |
  226. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  227. | void | :ref:`region_set_travel_cost<class_NavigationServer2D_method_region_set_travel_cost>` **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` travel_cost **)** |
  228. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  229. | 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 **)** |
  230. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  231. | void | :ref:`set_debug_enabled<class_NavigationServer2D_method_set_debug_enabled>` **(** :ref:`bool<class_bool>` enabled **)** |
  232. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  233. .. rst-class:: classref-section-separator
  234. ----
  235. .. rst-class:: classref-descriptions-group
  236. Signals
  237. -------
  238. .. _class_NavigationServer2D_signal_map_changed:
  239. .. rst-class:: classref-signal
  240. **map_changed** **(** :ref:`RID<class_RID>` map **)**
  241. Emitted when a navigation map is updated, when a region moves or is modified.
  242. .. rst-class:: classref-item-separator
  243. ----
  244. .. _class_NavigationServer2D_signal_navigation_debug_changed:
  245. .. rst-class:: classref-signal
  246. **navigation_debug_changed** **(** **)**
  247. Emitted when navigation debug settings are changed. Only available in debug builds.
  248. .. rst-class:: classref-section-separator
  249. ----
  250. .. rst-class:: classref-descriptions-group
  251. Method Descriptions
  252. -------------------
  253. .. _class_NavigationServer2D_method_agent_create:
  254. .. rst-class:: classref-method
  255. :ref:`RID<class_RID>` **agent_create** **(** **)**
  256. Creates the agent.
  257. .. rst-class:: classref-item-separator
  258. ----
  259. .. _class_NavigationServer2D_method_agent_get_avoidance_enabled:
  260. .. rst-class:: classref-method
  261. :ref:`bool<class_bool>` **agent_get_avoidance_enabled** **(** :ref:`RID<class_RID>` agent **)** |const|
  262. Return ``true`` if the specified ``agent`` uses avoidance.
  263. .. rst-class:: classref-item-separator
  264. ----
  265. .. _class_NavigationServer2D_method_agent_get_map:
  266. .. rst-class:: classref-method
  267. :ref:`RID<class_RID>` **agent_get_map** **(** :ref:`RID<class_RID>` agent **)** |const|
  268. Returns the navigation map :ref:`RID<class_RID>` the requested ``agent`` is currently assigned to.
  269. .. rst-class:: classref-item-separator
  270. ----
  271. .. _class_NavigationServer2D_method_agent_get_paused:
  272. .. rst-class:: classref-method
  273. :ref:`bool<class_bool>` **agent_get_paused** **(** :ref:`RID<class_RID>` agent **)** |const|
  274. Returns ``true`` if the specified ``agent`` is paused.
  275. .. rst-class:: classref-item-separator
  276. ----
  277. .. _class_NavigationServer2D_method_agent_is_map_changed:
  278. .. rst-class:: classref-method
  279. :ref:`bool<class_bool>` **agent_is_map_changed** **(** :ref:`RID<class_RID>` agent **)** |const|
  280. Returns true if the map got changed the previous frame.
  281. .. rst-class:: classref-item-separator
  282. ----
  283. .. _class_NavigationServer2D_method_agent_set_avoidance_callback:
  284. .. rst-class:: classref-method
  285. void **agent_set_avoidance_callback** **(** :ref:`RID<class_RID>` agent, :ref:`Callable<class_Callable>` callback **)**
  286. 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.
  287. \ **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>`.
  288. .. rst-class:: classref-item-separator
  289. ----
  290. .. _class_NavigationServer2D_method_agent_set_avoidance_enabled:
  291. .. rst-class:: classref-method
  292. void **agent_set_avoidance_enabled** **(** :ref:`RID<class_RID>` agent, :ref:`bool<class_bool>` enabled **)**
  293. If ``enabled`` is ``true``, the specified ``agent`` uses avoidance.
  294. .. rst-class:: classref-item-separator
  295. ----
  296. .. _class_NavigationServer2D_method_agent_set_avoidance_layers:
  297. .. rst-class:: classref-method
  298. void **agent_set_avoidance_layers** **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` layers **)**
  299. Set the agent's ``avoidance_layers`` bitmask.
  300. .. rst-class:: classref-item-separator
  301. ----
  302. .. _class_NavigationServer2D_method_agent_set_avoidance_mask:
  303. .. rst-class:: classref-method
  304. void **agent_set_avoidance_mask** **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` mask **)**
  305. Set the agent's ``avoidance_mask`` bitmask.
  306. .. rst-class:: classref-item-separator
  307. ----
  308. .. _class_NavigationServer2D_method_agent_set_avoidance_priority:
  309. .. rst-class:: classref-method
  310. void **agent_set_avoidance_priority** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` priority **)**
  311. Set the agent's ``avoidance_priority`` with a ``priority`` between 0.0 (lowest priority) to 1.0 (highest priority).
  312. 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.
  313. .. rst-class:: classref-item-separator
  314. ----
  315. .. _class_NavigationServer2D_method_agent_set_map:
  316. .. rst-class:: classref-method
  317. void **agent_set_map** **(** :ref:`RID<class_RID>` agent, :ref:`RID<class_RID>` map **)**
  318. Puts the agent in the map.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_NavigationServer2D_method_agent_set_max_neighbors:
  322. .. rst-class:: classref-method
  323. void **agent_set_max_neighbors** **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` count **)**
  324. 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.
  325. .. rst-class:: classref-item-separator
  326. ----
  327. .. _class_NavigationServer2D_method_agent_set_max_speed:
  328. .. rst-class:: classref-method
  329. void **agent_set_max_speed** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` max_speed **)**
  330. Sets the maximum speed of the agent. Must be positive.
  331. .. rst-class:: classref-item-separator
  332. ----
  333. .. _class_NavigationServer2D_method_agent_set_neighbor_distance:
  334. .. rst-class:: classref-method
  335. void **agent_set_neighbor_distance** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` distance **)**
  336. 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.
  337. .. rst-class:: classref-item-separator
  338. ----
  339. .. _class_NavigationServer2D_method_agent_set_paused:
  340. .. rst-class:: classref-method
  341. void **agent_set_paused** **(** :ref:`RID<class_RID>` agent, :ref:`bool<class_bool>` paused **)**
  342. If ``paused`` is true the specified ``agent`` will not be processed, e.g. calculate avoidance velocities or receive avoidance callbacks.
  343. .. rst-class:: classref-item-separator
  344. ----
  345. .. _class_NavigationServer2D_method_agent_set_position:
  346. .. rst-class:: classref-method
  347. void **agent_set_position** **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` position **)**
  348. Sets the position of the agent in world space.
  349. .. rst-class:: classref-item-separator
  350. ----
  351. .. _class_NavigationServer2D_method_agent_set_radius:
  352. .. rst-class:: classref-method
  353. void **agent_set_radius** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` radius **)**
  354. Sets the radius of the agent.
  355. .. rst-class:: classref-item-separator
  356. ----
  357. .. _class_NavigationServer2D_method_agent_set_time_horizon_agents:
  358. .. rst-class:: classref-method
  359. void **agent_set_time_horizon_agents** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time_horizon **)**
  360. 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.
  361. .. rst-class:: classref-item-separator
  362. ----
  363. .. _class_NavigationServer2D_method_agent_set_time_horizon_obstacles:
  364. .. rst-class:: classref-method
  365. void **agent_set_time_horizon_obstacles** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time_horizon **)**
  366. 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.
  367. .. rst-class:: classref-item-separator
  368. ----
  369. .. _class_NavigationServer2D_method_agent_set_velocity:
  370. .. rst-class:: classref-method
  371. void **agent_set_velocity** **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)**
  372. 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.
  373. .. rst-class:: classref-item-separator
  374. ----
  375. .. _class_NavigationServer2D_method_agent_set_velocity_forced:
  376. .. rst-class:: classref-method
  377. void **agent_set_velocity_forced** **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)**
  378. 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.
  379. .. rst-class:: classref-item-separator
  380. ----
  381. .. _class_NavigationServer2D_method_bake_from_source_geometry_data:
  382. .. rst-class:: classref-method
  383. void **bake_from_source_geometry_data** **(** :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon, :ref:`NavigationMeshSourceGeometryData2D<class_NavigationMeshSourceGeometryData2D>` source_geometry_data, :ref:`Callable<class_Callable>` callback=Callable() **)**
  384. Bakes the provided ``navigation_polygon`` with the data from the provided ``source_geometry_data``. After the process is finished the optional ``callback`` will be called.
  385. .. rst-class:: classref-item-separator
  386. ----
  387. .. _class_NavigationServer2D_method_bake_from_source_geometry_data_async:
  388. .. rst-class:: classref-method
  389. void **bake_from_source_geometry_data_async** **(** :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon, :ref:`NavigationMeshSourceGeometryData2D<class_NavigationMeshSourceGeometryData2D>` source_geometry_data, :ref:`Callable<class_Callable>` callback=Callable() **)**
  390. Bakes the provided ``navigation_polygon`` with the data from the provided ``source_geometry_data`` as an async task running on a background thread. After the process is finished the optional ``callback`` will be called.
  391. .. rst-class:: classref-item-separator
  392. ----
  393. .. _class_NavigationServer2D_method_free_rid:
  394. .. rst-class:: classref-method
  395. void **free_rid** **(** :ref:`RID<class_RID>` rid **)**
  396. Destroys the given RID.
  397. .. rst-class:: classref-item-separator
  398. ----
  399. .. _class_NavigationServer2D_method_get_debug_enabled:
  400. .. rst-class:: classref-method
  401. :ref:`bool<class_bool>` **get_debug_enabled** **(** **)** |const|
  402. Returns ``true`` when the NavigationServer has debug enabled.
  403. .. rst-class:: classref-item-separator
  404. ----
  405. .. _class_NavigationServer2D_method_get_maps:
  406. .. rst-class:: classref-method
  407. :ref:`RID[]<class_RID>` **get_maps** **(** **)** |const|
  408. 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.
  409. .. rst-class:: classref-item-separator
  410. ----
  411. .. _class_NavigationServer2D_method_link_create:
  412. .. rst-class:: classref-method
  413. :ref:`RID<class_RID>` **link_create** **(** **)**
  414. Create a new link between two positions on a map.
  415. .. rst-class:: classref-item-separator
  416. ----
  417. .. _class_NavigationServer2D_method_link_get_enabled:
  418. .. rst-class:: classref-method
  419. :ref:`bool<class_bool>` **link_get_enabled** **(** :ref:`RID<class_RID>` link **)** |const|
  420. Returns ``true`` if the specified ``link`` is enabled.
  421. .. rst-class:: classref-item-separator
  422. ----
  423. .. _class_NavigationServer2D_method_link_get_end_position:
  424. .. rst-class:: classref-method
  425. :ref:`Vector2<class_Vector2>` **link_get_end_position** **(** :ref:`RID<class_RID>` link **)** |const|
  426. Returns the ending position of this ``link``.
  427. .. rst-class:: classref-item-separator
  428. ----
  429. .. _class_NavigationServer2D_method_link_get_enter_cost:
  430. .. rst-class:: classref-method
  431. :ref:`float<class_float>` **link_get_enter_cost** **(** :ref:`RID<class_RID>` link **)** |const|
  432. Returns the enter cost of this ``link``.
  433. .. rst-class:: classref-item-separator
  434. ----
  435. .. _class_NavigationServer2D_method_link_get_map:
  436. .. rst-class:: classref-method
  437. :ref:`RID<class_RID>` **link_get_map** **(** :ref:`RID<class_RID>` link **)** |const|
  438. Returns the navigation map :ref:`RID<class_RID>` the requested ``link`` is currently assigned to.
  439. .. rst-class:: classref-item-separator
  440. ----
  441. .. _class_NavigationServer2D_method_link_get_navigation_layers:
  442. .. rst-class:: classref-method
  443. :ref:`int<class_int>` **link_get_navigation_layers** **(** :ref:`RID<class_RID>` link **)** |const|
  444. Returns the navigation layers for this ``link``.
  445. .. rst-class:: classref-item-separator
  446. ----
  447. .. _class_NavigationServer2D_method_link_get_owner_id:
  448. .. rst-class:: classref-method
  449. :ref:`int<class_int>` **link_get_owner_id** **(** :ref:`RID<class_RID>` link **)** |const|
  450. Returns the ``ObjectID`` of the object which manages this link.
  451. .. rst-class:: classref-item-separator
  452. ----
  453. .. _class_NavigationServer2D_method_link_get_start_position:
  454. .. rst-class:: classref-method
  455. :ref:`Vector2<class_Vector2>` **link_get_start_position** **(** :ref:`RID<class_RID>` link **)** |const|
  456. Returns the starting position of this ``link``.
  457. .. rst-class:: classref-item-separator
  458. ----
  459. .. _class_NavigationServer2D_method_link_get_travel_cost:
  460. .. rst-class:: classref-method
  461. :ref:`float<class_float>` **link_get_travel_cost** **(** :ref:`RID<class_RID>` link **)** |const|
  462. Returns the travel cost of this ``link``.
  463. .. rst-class:: classref-item-separator
  464. ----
  465. .. _class_NavigationServer2D_method_link_is_bidirectional:
  466. .. rst-class:: classref-method
  467. :ref:`bool<class_bool>` **link_is_bidirectional** **(** :ref:`RID<class_RID>` link **)** |const|
  468. Returns whether this ``link`` can be travelled in both directions.
  469. .. rst-class:: classref-item-separator
  470. ----
  471. .. _class_NavigationServer2D_method_link_set_bidirectional:
  472. .. rst-class:: classref-method
  473. void **link_set_bidirectional** **(** :ref:`RID<class_RID>` link, :ref:`bool<class_bool>` bidirectional **)**
  474. Sets whether this ``link`` can be travelled in both directions.
  475. .. rst-class:: classref-item-separator
  476. ----
  477. .. _class_NavigationServer2D_method_link_set_enabled:
  478. .. rst-class:: classref-method
  479. void **link_set_enabled** **(** :ref:`RID<class_RID>` link, :ref:`bool<class_bool>` enabled **)**
  480. If ``enabled`` is ``true``, the specified ``link`` will contribute to its current navigation map.
  481. .. rst-class:: classref-item-separator
  482. ----
  483. .. _class_NavigationServer2D_method_link_set_end_position:
  484. .. rst-class:: classref-method
  485. void **link_set_end_position** **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)**
  486. Sets the exit position for the ``link``.
  487. .. rst-class:: classref-item-separator
  488. ----
  489. .. _class_NavigationServer2D_method_link_set_enter_cost:
  490. .. rst-class:: classref-method
  491. void **link_set_enter_cost** **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` enter_cost **)**
  492. Sets the ``enter_cost`` for this ``link``.
  493. .. rst-class:: classref-item-separator
  494. ----
  495. .. _class_NavigationServer2D_method_link_set_map:
  496. .. rst-class:: classref-method
  497. void **link_set_map** **(** :ref:`RID<class_RID>` link, :ref:`RID<class_RID>` map **)**
  498. Sets the navigation map :ref:`RID<class_RID>` for the link.
  499. .. rst-class:: classref-item-separator
  500. ----
  501. .. _class_NavigationServer2D_method_link_set_navigation_layers:
  502. .. rst-class:: classref-method
  503. void **link_set_navigation_layers** **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` navigation_layers **)**
  504. 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>`).
  505. .. rst-class:: classref-item-separator
  506. ----
  507. .. _class_NavigationServer2D_method_link_set_owner_id:
  508. .. rst-class:: classref-method
  509. void **link_set_owner_id** **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` owner_id **)**
  510. Set the ``ObjectID`` of the object which manages this link.
  511. .. rst-class:: classref-item-separator
  512. ----
  513. .. _class_NavigationServer2D_method_link_set_start_position:
  514. .. rst-class:: classref-method
  515. void **link_set_start_position** **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)**
  516. Sets the entry position for this ``link``.
  517. .. rst-class:: classref-item-separator
  518. ----
  519. .. _class_NavigationServer2D_method_link_set_travel_cost:
  520. .. rst-class:: classref-method
  521. void **link_set_travel_cost** **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` travel_cost **)**
  522. Sets the ``travel_cost`` for this ``link``.
  523. .. rst-class:: classref-item-separator
  524. ----
  525. .. _class_NavigationServer2D_method_map_create:
  526. .. rst-class:: classref-method
  527. :ref:`RID<class_RID>` **map_create** **(** **)**
  528. Create a new map.
  529. .. rst-class:: classref-item-separator
  530. ----
  531. .. _class_NavigationServer2D_method_map_force_update:
  532. .. rst-class:: classref-method
  533. void **map_force_update** **(** :ref:`RID<class_RID>` map **)**
  534. 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).
  535. 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.
  536. Avoidance processing and dispatch of the ``safe_velocity`` signals is unaffected by this function and continues to happen for all maps and agents at the end of the physics frame.
  537. \ **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.
  538. .. rst-class:: classref-item-separator
  539. ----
  540. .. _class_NavigationServer2D_method_map_get_agents:
  541. .. rst-class:: classref-method
  542. :ref:`RID[]<class_RID>` **map_get_agents** **(** :ref:`RID<class_RID>` map **)** |const|
  543. Returns all navigation agents :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  544. .. rst-class:: classref-item-separator
  545. ----
  546. .. _class_NavigationServer2D_method_map_get_cell_size:
  547. .. rst-class:: classref-method
  548. :ref:`float<class_float>` **map_get_cell_size** **(** :ref:`RID<class_RID>` map **)** |const|
  549. Returns the map cell size used to rasterize the navigation mesh vertices.
  550. .. rst-class:: classref-item-separator
  551. ----
  552. .. _class_NavigationServer2D_method_map_get_closest_point:
  553. .. rst-class:: classref-method
  554. :ref:`Vector2<class_Vector2>` **map_get_closest_point** **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` to_point **)** |const|
  555. Returns the point closest to the provided ``to_point`` on the navigation mesh surface.
  556. .. rst-class:: classref-item-separator
  557. ----
  558. .. _class_NavigationServer2D_method_map_get_closest_point_owner:
  559. .. rst-class:: classref-method
  560. :ref:`RID<class_RID>` **map_get_closest_point_owner** **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` to_point **)** |const|
  561. Returns the owner region RID for the point returned by :ref:`map_get_closest_point<class_NavigationServer2D_method_map_get_closest_point>`.
  562. .. rst-class:: classref-item-separator
  563. ----
  564. .. _class_NavigationServer2D_method_map_get_edge_connection_margin:
  565. .. rst-class:: classref-method
  566. :ref:`float<class_float>` **map_get_edge_connection_margin** **(** :ref:`RID<class_RID>` map **)** |const|
  567. Returns the edge connection margin of the map. The edge connection margin is a distance used to connect two regions.
  568. .. rst-class:: classref-item-separator
  569. ----
  570. .. _class_NavigationServer2D_method_map_get_link_connection_radius:
  571. .. rst-class:: classref-method
  572. :ref:`float<class_float>` **map_get_link_connection_radius** **(** :ref:`RID<class_RID>` map **)** |const|
  573. 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.
  574. .. rst-class:: classref-item-separator
  575. ----
  576. .. _class_NavigationServer2D_method_map_get_links:
  577. .. rst-class:: classref-method
  578. :ref:`RID[]<class_RID>` **map_get_links** **(** :ref:`RID<class_RID>` map **)** |const|
  579. Returns all navigation link :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  580. .. rst-class:: classref-item-separator
  581. ----
  582. .. _class_NavigationServer2D_method_map_get_obstacles:
  583. .. rst-class:: classref-method
  584. :ref:`RID[]<class_RID>` **map_get_obstacles** **(** :ref:`RID<class_RID>` map **)** |const|
  585. Returns all navigation obstacle :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  586. .. rst-class:: classref-item-separator
  587. ----
  588. .. _class_NavigationServer2D_method_map_get_path:
  589. .. rst-class:: classref-method
  590. :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|
  591. 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.
  592. .. rst-class:: classref-item-separator
  593. ----
  594. .. _class_NavigationServer2D_method_map_get_regions:
  595. .. rst-class:: classref-method
  596. :ref:`RID[]<class_RID>` **map_get_regions** **(** :ref:`RID<class_RID>` map **)** |const|
  597. Returns all navigation regions :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  598. .. rst-class:: classref-item-separator
  599. ----
  600. .. _class_NavigationServer2D_method_map_get_use_edge_connections:
  601. .. rst-class:: classref-method
  602. :ref:`bool<class_bool>` **map_get_use_edge_connections** **(** :ref:`RID<class_RID>` map **)** |const|
  603. 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.
  604. .. rst-class:: classref-item-separator
  605. ----
  606. .. _class_NavigationServer2D_method_map_is_active:
  607. .. rst-class:: classref-method
  608. :ref:`bool<class_bool>` **map_is_active** **(** :ref:`RID<class_RID>` map **)** |const|
  609. Returns true if the map is active.
  610. .. rst-class:: classref-item-separator
  611. ----
  612. .. _class_NavigationServer2D_method_map_set_active:
  613. .. rst-class:: classref-method
  614. void **map_set_active** **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` active **)**
  615. Sets the map active.
  616. .. rst-class:: classref-item-separator
  617. ----
  618. .. _class_NavigationServer2D_method_map_set_cell_size:
  619. .. rst-class:: classref-method
  620. void **map_set_cell_size** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` cell_size **)**
  621. Sets the map cell size used to rasterize the navigation mesh vertices. Must match with the cell size of the used navigation meshes.
  622. .. rst-class:: classref-item-separator
  623. ----
  624. .. _class_NavigationServer2D_method_map_set_edge_connection_margin:
  625. .. rst-class:: classref-method
  626. void **map_set_edge_connection_margin** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` margin **)**
  627. Set the map edge connection margin used to weld the compatible region edges.
  628. .. rst-class:: classref-item-separator
  629. ----
  630. .. _class_NavigationServer2D_method_map_set_link_connection_radius:
  631. .. rst-class:: classref-method
  632. void **map_set_link_connection_radius** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` radius **)**
  633. Set the map's link connection radius used to connect links to navigation polygons.
  634. .. rst-class:: classref-item-separator
  635. ----
  636. .. _class_NavigationServer2D_method_map_set_use_edge_connections:
  637. .. rst-class:: classref-method
  638. void **map_set_use_edge_connections** **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` enabled **)**
  639. Set the navigation ``map`` edge connection use. If ``enabled`` is ``true``, 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.
  640. .. rst-class:: classref-item-separator
  641. ----
  642. .. _class_NavigationServer2D_method_obstacle_create:
  643. .. rst-class:: classref-method
  644. :ref:`RID<class_RID>` **obstacle_create** **(** **)**
  645. Creates a new navigation obstacle.
  646. .. rst-class:: classref-item-separator
  647. ----
  648. .. _class_NavigationServer2D_method_obstacle_get_avoidance_enabled:
  649. .. rst-class:: classref-method
  650. :ref:`bool<class_bool>` **obstacle_get_avoidance_enabled** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  651. Returns ``true`` if the provided ``obstacle`` has avoidance enabled.
  652. .. rst-class:: classref-item-separator
  653. ----
  654. .. _class_NavigationServer2D_method_obstacle_get_map:
  655. .. rst-class:: classref-method
  656. :ref:`RID<class_RID>` **obstacle_get_map** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  657. Returns the navigation map :ref:`RID<class_RID>` the requested ``obstacle`` is currently assigned to.
  658. .. rst-class:: classref-item-separator
  659. ----
  660. .. _class_NavigationServer2D_method_obstacle_get_paused:
  661. .. rst-class:: classref-method
  662. :ref:`bool<class_bool>` **obstacle_get_paused** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  663. Returns ``true`` if the specified ``obstacle`` is paused.
  664. .. rst-class:: classref-item-separator
  665. ----
  666. .. _class_NavigationServer2D_method_obstacle_set_avoidance_enabled:
  667. .. rst-class:: classref-method
  668. void **obstacle_set_avoidance_enabled** **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` enabled **)**
  669. If ``enabled`` is ``true``, the provided ``obstacle`` affects avoidance using agents.
  670. .. rst-class:: classref-item-separator
  671. ----
  672. .. _class_NavigationServer2D_method_obstacle_set_avoidance_layers:
  673. .. rst-class:: classref-method
  674. void **obstacle_set_avoidance_layers** **(** :ref:`RID<class_RID>` obstacle, :ref:`int<class_int>` layers **)**
  675. Set the obstacles's ``avoidance_layers`` bitmask.
  676. .. rst-class:: classref-item-separator
  677. ----
  678. .. _class_NavigationServer2D_method_obstacle_set_map:
  679. .. rst-class:: classref-method
  680. void **obstacle_set_map** **(** :ref:`RID<class_RID>` obstacle, :ref:`RID<class_RID>` map **)**
  681. Sets the navigation map :ref:`RID<class_RID>` for the obstacle.
  682. .. rst-class:: classref-item-separator
  683. ----
  684. .. _class_NavigationServer2D_method_obstacle_set_paused:
  685. .. rst-class:: classref-method
  686. void **obstacle_set_paused** **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` paused **)**
  687. If ``paused`` is true the specified ``obstacle`` will not be processed, e.g. affect avoidance velocities.
  688. .. rst-class:: classref-item-separator
  689. ----
  690. .. _class_NavigationServer2D_method_obstacle_set_position:
  691. .. rst-class:: classref-method
  692. void **obstacle_set_position** **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` position **)**
  693. Sets the position of the obstacle in world space.
  694. .. rst-class:: classref-item-separator
  695. ----
  696. .. _class_NavigationServer2D_method_obstacle_set_radius:
  697. .. rst-class:: classref-method
  698. void **obstacle_set_radius** **(** :ref:`RID<class_RID>` obstacle, :ref:`float<class_float>` radius **)**
  699. Sets the radius of the dynamic obstacle.
  700. .. rst-class:: classref-item-separator
  701. ----
  702. .. _class_NavigationServer2D_method_obstacle_set_velocity:
  703. .. rst-class:: classref-method
  704. void **obstacle_set_velocity** **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` velocity **)**
  705. 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.
  706. .. rst-class:: classref-item-separator
  707. ----
  708. .. _class_NavigationServer2D_method_obstacle_set_vertices:
  709. .. rst-class:: classref-method
  710. void **obstacle_set_vertices** **(** :ref:`RID<class_RID>` obstacle, :ref:`PackedVector2Array<class_PackedVector2Array>` vertices **)**
  711. 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.
  712. .. rst-class:: classref-item-separator
  713. ----
  714. .. _class_NavigationServer2D_method_parse_source_geometry_data:
  715. .. rst-class:: classref-method
  716. void **parse_source_geometry_data** **(** :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon, :ref:`NavigationMeshSourceGeometryData2D<class_NavigationMeshSourceGeometryData2D>` source_geometry_data, :ref:`Node<class_Node>` root_node, :ref:`Callable<class_Callable>` callback=Callable() **)**
  717. Parses the :ref:`SceneTree<class_SceneTree>` for source geometry according to the properties of ``navigation_polygon``. Updates the provided ``source_geometry_data`` resource with the resulting data. The resource can then be used to bake a navigation mesh with :ref:`bake_from_source_geometry_data<class_NavigationServer2D_method_bake_from_source_geometry_data>`. After the process is finished the optional ``callback`` will be called.
  718. \ **Note:** This function needs to run on the main thread or with a deferred call as the SceneTree is not thread-safe.
  719. \ **Performance:** While convenient, reading data arrays from :ref:`Mesh<class_Mesh>` resources can affect the frame rate negatively. The data needs to be received from the GPU, stalling the :ref:`RenderingServer<class_RenderingServer>` in the process. For performance prefer the use of e.g. collision shapes or creating the data arrays entirely in code.
  720. .. rst-class:: classref-item-separator
  721. ----
  722. .. _class_NavigationServer2D_method_query_path:
  723. .. rst-class:: classref-method
  724. void **query_path** **(** :ref:`NavigationPathQueryParameters2D<class_NavigationPathQueryParameters2D>` parameters, :ref:`NavigationPathQueryResult2D<class_NavigationPathQueryResult2D>` result **)** |const|
  725. 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.
  726. .. rst-class:: classref-item-separator
  727. ----
  728. .. _class_NavigationServer2D_method_region_create:
  729. .. rst-class:: classref-method
  730. :ref:`RID<class_RID>` **region_create** **(** **)**
  731. Creates a new region.
  732. .. rst-class:: classref-item-separator
  733. ----
  734. .. _class_NavigationServer2D_method_region_get_connection_pathway_end:
  735. .. rst-class:: classref-method
  736. :ref:`Vector2<class_Vector2>` **region_get_connection_pathway_end** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` connection **)** |const|
  737. 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>`.
  738. .. rst-class:: classref-item-separator
  739. ----
  740. .. _class_NavigationServer2D_method_region_get_connection_pathway_start:
  741. .. rst-class:: classref-method
  742. :ref:`Vector2<class_Vector2>` **region_get_connection_pathway_start** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` connection **)** |const|
  743. 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>`.
  744. .. rst-class:: classref-item-separator
  745. ----
  746. .. _class_NavigationServer2D_method_region_get_connections_count:
  747. .. rst-class:: classref-method
  748. :ref:`int<class_int>` **region_get_connections_count** **(** :ref:`RID<class_RID>` region **)** |const|
  749. Returns how many connections this ``region`` has with other regions in the map.
  750. .. rst-class:: classref-item-separator
  751. ----
  752. .. _class_NavigationServer2D_method_region_get_enabled:
  753. .. rst-class:: classref-method
  754. :ref:`bool<class_bool>` **region_get_enabled** **(** :ref:`RID<class_RID>` region **)** |const|
  755. Returns ``true`` if the specified ``region`` is enabled.
  756. .. rst-class:: classref-item-separator
  757. ----
  758. .. _class_NavigationServer2D_method_region_get_enter_cost:
  759. .. rst-class:: classref-method
  760. :ref:`float<class_float>` **region_get_enter_cost** **(** :ref:`RID<class_RID>` region **)** |const|
  761. Returns the enter cost of this ``region``.
  762. .. rst-class:: classref-item-separator
  763. ----
  764. .. _class_NavigationServer2D_method_region_get_map:
  765. .. rst-class:: classref-method
  766. :ref:`RID<class_RID>` **region_get_map** **(** :ref:`RID<class_RID>` region **)** |const|
  767. Returns the navigation map :ref:`RID<class_RID>` the requested ``region`` is currently assigned to.
  768. .. rst-class:: classref-item-separator
  769. ----
  770. .. _class_NavigationServer2D_method_region_get_navigation_layers:
  771. .. rst-class:: classref-method
  772. :ref:`int<class_int>` **region_get_navigation_layers** **(** :ref:`RID<class_RID>` region **)** |const|
  773. Returns the region's navigation layers.
  774. .. rst-class:: classref-item-separator
  775. ----
  776. .. _class_NavigationServer2D_method_region_get_owner_id:
  777. .. rst-class:: classref-method
  778. :ref:`int<class_int>` **region_get_owner_id** **(** :ref:`RID<class_RID>` region **)** |const|
  779. Returns the ``ObjectID`` of the object which manages this region.
  780. .. rst-class:: classref-item-separator
  781. ----
  782. .. _class_NavigationServer2D_method_region_get_travel_cost:
  783. .. rst-class:: classref-method
  784. :ref:`float<class_float>` **region_get_travel_cost** **(** :ref:`RID<class_RID>` region **)** |const|
  785. Returns the travel cost of this ``region``.
  786. .. rst-class:: classref-item-separator
  787. ----
  788. .. _class_NavigationServer2D_method_region_get_use_edge_connections:
  789. .. rst-class:: classref-method
  790. :ref:`bool<class_bool>` **region_get_use_edge_connections** **(** :ref:`RID<class_RID>` region **)** |const|
  791. 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.
  792. .. rst-class:: classref-item-separator
  793. ----
  794. .. _class_NavigationServer2D_method_region_owns_point:
  795. .. rst-class:: classref-method
  796. :ref:`bool<class_bool>` **region_owns_point** **(** :ref:`RID<class_RID>` region, :ref:`Vector2<class_Vector2>` point **)** |const|
  797. 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.
  798. 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.
  799. \ **Note:** If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected.
  800. .. rst-class:: classref-item-separator
  801. ----
  802. .. _class_NavigationServer2D_method_region_set_enabled:
  803. .. rst-class:: classref-method
  804. void **region_set_enabled** **(** :ref:`RID<class_RID>` region, :ref:`bool<class_bool>` enabled **)**
  805. If ``enabled`` is ``true`` the specified ``region`` will contribute to its current navigation map.
  806. .. rst-class:: classref-item-separator
  807. ----
  808. .. _class_NavigationServer2D_method_region_set_enter_cost:
  809. .. rst-class:: classref-method
  810. void **region_set_enter_cost** **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` enter_cost **)**
  811. Sets the ``enter_cost`` for this ``region``.
  812. .. rst-class:: classref-item-separator
  813. ----
  814. .. _class_NavigationServer2D_method_region_set_map:
  815. .. rst-class:: classref-method
  816. void **region_set_map** **(** :ref:`RID<class_RID>` region, :ref:`RID<class_RID>` map **)**
  817. Sets the map for the region.
  818. .. rst-class:: classref-item-separator
  819. ----
  820. .. _class_NavigationServer2D_method_region_set_navigation_layers:
  821. .. rst-class:: classref-method
  822. void **region_set_navigation_layers** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` navigation_layers **)**
  823. 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>`).
  824. .. rst-class:: classref-item-separator
  825. ----
  826. .. _class_NavigationServer2D_method_region_set_navigation_polygon:
  827. .. rst-class:: classref-method
  828. void **region_set_navigation_polygon** **(** :ref:`RID<class_RID>` region, :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon **)**
  829. Sets the ``navigation_polygon`` for the region.
  830. .. rst-class:: classref-item-separator
  831. ----
  832. .. _class_NavigationServer2D_method_region_set_owner_id:
  833. .. rst-class:: classref-method
  834. void **region_set_owner_id** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` owner_id **)**
  835. Set the ``ObjectID`` of the object which manages this region.
  836. .. rst-class:: classref-item-separator
  837. ----
  838. .. _class_NavigationServer2D_method_region_set_transform:
  839. .. rst-class:: classref-method
  840. void **region_set_transform** **(** :ref:`RID<class_RID>` region, :ref:`Transform2D<class_Transform2D>` transform **)**
  841. Sets the global transformation for the region.
  842. .. rst-class:: classref-item-separator
  843. ----
  844. .. _class_NavigationServer2D_method_region_set_travel_cost:
  845. .. rst-class:: classref-method
  846. void **region_set_travel_cost** **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` travel_cost **)**
  847. Sets the ``travel_cost`` for this ``region``.
  848. .. rst-class:: classref-item-separator
  849. ----
  850. .. _class_NavigationServer2D_method_region_set_use_edge_connections:
  851. .. rst-class:: classref-method
  852. void **region_set_use_edge_connections** **(** :ref:`RID<class_RID>` region, :ref:`bool<class_bool>` enabled **)**
  853. If ``enabled`` is ``true``, the navigation ``region`` will use edge connections to connect with other navigation regions within proximity of the navigation map edge connection margin.
  854. .. rst-class:: classref-item-separator
  855. ----
  856. .. _class_NavigationServer2D_method_set_debug_enabled:
  857. .. rst-class:: classref-method
  858. void **set_debug_enabled** **(** :ref:`bool<class_bool>` enabled **)**
  859. If ``true`` enables debug mode on the NavigationServer.
  860. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  861. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  862. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  863. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  864. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  865. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  866. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`