class_navigationserver2d.rst 150 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/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:`int<class_int>` | :ref:`agent_get_avoidance_layers<class_NavigationServer2D_method_agent_get_avoidance_layers>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  38. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`agent_get_avoidance_mask<class_NavigationServer2D_method_agent_get_avoidance_mask>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  40. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`float<class_float>` | :ref:`agent_get_avoidance_priority<class_NavigationServer2D_method_agent_get_avoidance_priority>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  42. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`RID<class_RID>` | :ref:`agent_get_map<class_NavigationServer2D_method_agent_get_map>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  44. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`int<class_int>` | :ref:`agent_get_max_neighbors<class_NavigationServer2D_method_agent_get_max_neighbors>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  46. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`float<class_float>` | :ref:`agent_get_max_speed<class_NavigationServer2D_method_agent_get_max_speed>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  48. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`float<class_float>` | :ref:`agent_get_neighbor_distance<class_NavigationServer2D_method_agent_get_neighbor_distance>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  50. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`agent_get_paused<class_NavigationServer2D_method_agent_get_paused>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  52. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Vector2<class_Vector2>` | :ref:`agent_get_position<class_NavigationServer2D_method_agent_get_position>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  54. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`float<class_float>` | :ref:`agent_get_radius<class_NavigationServer2D_method_agent_get_radius>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  56. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`float<class_float>` | :ref:`agent_get_time_horizon_agents<class_NavigationServer2D_method_agent_get_time_horizon_agents>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  58. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`float<class_float>` | :ref:`agent_get_time_horizon_obstacles<class_NavigationServer2D_method_agent_get_time_horizon_obstacles>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  60. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`Vector2<class_Vector2>` | :ref:`agent_get_velocity<class_NavigationServer2D_method_agent_get_velocity>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  62. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`agent_has_avoidance_callback<class_NavigationServer2D_method_agent_has_avoidance_callback>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  64. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`agent_is_map_changed<class_NavigationServer2D_method_agent_is_map_changed>` **(** :ref:`RID<class_RID>` agent **)** |const| |
  66. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`agent_set_avoidance_callback<class_NavigationServer2D_method_agent_set_avoidance_callback>` **(** :ref:`RID<class_RID>` agent, :ref:`Callable<class_Callable>` callback **)** |
  68. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`agent_set_avoidance_enabled<class_NavigationServer2D_method_agent_set_avoidance_enabled>` **(** :ref:`RID<class_RID>` agent, :ref:`bool<class_bool>` enabled **)** |
  70. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`agent_set_avoidance_layers<class_NavigationServer2D_method_agent_set_avoidance_layers>` **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` layers **)** |
  72. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`agent_set_avoidance_mask<class_NavigationServer2D_method_agent_set_avoidance_mask>` **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` mask **)** |
  74. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`agent_set_avoidance_priority<class_NavigationServer2D_method_agent_set_avoidance_priority>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` priority **)** |
  76. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`agent_set_map<class_NavigationServer2D_method_agent_set_map>` **(** :ref:`RID<class_RID>` agent, :ref:`RID<class_RID>` map **)** |
  78. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`agent_set_max_neighbors<class_NavigationServer2D_method_agent_set_max_neighbors>` **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` count **)** |
  80. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | void | :ref:`agent_set_max_speed<class_NavigationServer2D_method_agent_set_max_speed>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` max_speed **)** |
  82. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`agent_set_neighbor_distance<class_NavigationServer2D_method_agent_set_neighbor_distance>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` distance **)** |
  84. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`agent_set_paused<class_NavigationServer2D_method_agent_set_paused>` **(** :ref:`RID<class_RID>` agent, :ref:`bool<class_bool>` paused **)** |
  86. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`agent_set_position<class_NavigationServer2D_method_agent_set_position>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` position **)** |
  88. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | void | :ref:`agent_set_radius<class_NavigationServer2D_method_agent_set_radius>` **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` radius **)** |
  90. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | 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 **)** |
  92. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | 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 **)** |
  94. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | void | :ref:`agent_set_velocity<class_NavigationServer2D_method_agent_set_velocity>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)** |
  96. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | void | :ref:`agent_set_velocity_forced<class_NavigationServer2D_method_agent_set_velocity_forced>` **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)** |
  98. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | 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() **)** |
  100. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | 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() **)** |
  102. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | void | :ref:`free_rid<class_NavigationServer2D_method_free_rid>` **(** :ref:`RID<class_RID>` rid **)** |
  104. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`bool<class_bool>` | :ref:`get_debug_enabled<class_NavigationServer2D_method_get_debug_enabled>` **(** **)** |const| |
  106. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`RID[]<class_RID>` | :ref:`get_maps<class_NavigationServer2D_method_get_maps>` **(** **)** |const| |
  108. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`RID<class_RID>` | :ref:`link_create<class_NavigationServer2D_method_link_create>` **(** **)** |
  110. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`bool<class_bool>` | :ref:`link_get_enabled<class_NavigationServer2D_method_link_get_enabled>` **(** :ref:`RID<class_RID>` link **)** |const| |
  112. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | :ref:`Vector2<class_Vector2>` | :ref:`link_get_end_position<class_NavigationServer2D_method_link_get_end_position>` **(** :ref:`RID<class_RID>` link **)** |const| |
  114. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`float<class_float>` | :ref:`link_get_enter_cost<class_NavigationServer2D_method_link_get_enter_cost>` **(** :ref:`RID<class_RID>` link **)** |const| |
  116. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | :ref:`RID<class_RID>` | :ref:`link_get_map<class_NavigationServer2D_method_link_get_map>` **(** :ref:`RID<class_RID>` link **)** |const| |
  118. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | :ref:`int<class_int>` | :ref:`link_get_navigation_layers<class_NavigationServer2D_method_link_get_navigation_layers>` **(** :ref:`RID<class_RID>` link **)** |const| |
  120. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | :ref:`int<class_int>` | :ref:`link_get_owner_id<class_NavigationServer2D_method_link_get_owner_id>` **(** :ref:`RID<class_RID>` link **)** |const| |
  122. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | :ref:`Vector2<class_Vector2>` | :ref:`link_get_start_position<class_NavigationServer2D_method_link_get_start_position>` **(** :ref:`RID<class_RID>` link **)** |const| |
  124. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | :ref:`float<class_float>` | :ref:`link_get_travel_cost<class_NavigationServer2D_method_link_get_travel_cost>` **(** :ref:`RID<class_RID>` link **)** |const| |
  126. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`bool<class_bool>` | :ref:`link_is_bidirectional<class_NavigationServer2D_method_link_is_bidirectional>` **(** :ref:`RID<class_RID>` link **)** |const| |
  128. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | void | :ref:`link_set_bidirectional<class_NavigationServer2D_method_link_set_bidirectional>` **(** :ref:`RID<class_RID>` link, :ref:`bool<class_bool>` bidirectional **)** |
  130. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | void | :ref:`link_set_enabled<class_NavigationServer2D_method_link_set_enabled>` **(** :ref:`RID<class_RID>` link, :ref:`bool<class_bool>` enabled **)** |
  132. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | void | :ref:`link_set_end_position<class_NavigationServer2D_method_link_set_end_position>` **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)** |
  134. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | void | :ref:`link_set_enter_cost<class_NavigationServer2D_method_link_set_enter_cost>` **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` enter_cost **)** |
  136. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | void | :ref:`link_set_map<class_NavigationServer2D_method_link_set_map>` **(** :ref:`RID<class_RID>` link, :ref:`RID<class_RID>` map **)** |
  138. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | void | :ref:`link_set_navigation_layers<class_NavigationServer2D_method_link_set_navigation_layers>` **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` navigation_layers **)** |
  140. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | void | :ref:`link_set_owner_id<class_NavigationServer2D_method_link_set_owner_id>` **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` owner_id **)** |
  142. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | void | :ref:`link_set_start_position<class_NavigationServer2D_method_link_set_start_position>` **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)** |
  144. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | void | :ref:`link_set_travel_cost<class_NavigationServer2D_method_link_set_travel_cost>` **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` travel_cost **)** |
  146. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | :ref:`RID<class_RID>` | :ref:`map_create<class_NavigationServer2D_method_map_create>` **(** **)** |
  148. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | void | :ref:`map_force_update<class_NavigationServer2D_method_map_force_update>` **(** :ref:`RID<class_RID>` map **)** |
  150. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | :ref:`RID[]<class_RID>` | :ref:`map_get_agents<class_NavigationServer2D_method_map_get_agents>` **(** :ref:`RID<class_RID>` map **)** |const| |
  152. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. | :ref:`float<class_float>` | :ref:`map_get_cell_size<class_NavigationServer2D_method_map_get_cell_size>` **(** :ref:`RID<class_RID>` map **)** |const| |
  154. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  155. | :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| |
  156. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  157. | :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| |
  158. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  159. | :ref:`float<class_float>` | :ref:`map_get_edge_connection_margin<class_NavigationServer2D_method_map_get_edge_connection_margin>` **(** :ref:`RID<class_RID>` map **)** |const| |
  160. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  161. | :ref:`float<class_float>` | :ref:`map_get_link_connection_radius<class_NavigationServer2D_method_map_get_link_connection_radius>` **(** :ref:`RID<class_RID>` map **)** |const| |
  162. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  163. | :ref:`RID[]<class_RID>` | :ref:`map_get_links<class_NavigationServer2D_method_map_get_links>` **(** :ref:`RID<class_RID>` map **)** |const| |
  164. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  165. | :ref:`RID[]<class_RID>` | :ref:`map_get_obstacles<class_NavigationServer2D_method_map_get_obstacles>` **(** :ref:`RID<class_RID>` map **)** |const| |
  166. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  167. | :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| |
  168. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  169. | :ref:`Vector2<class_Vector2>` | :ref:`map_get_random_point<class_NavigationServer2D_method_map_get_random_point>` **(** :ref:`RID<class_RID>` map, :ref:`int<class_int>` navigation_layers, :ref:`bool<class_bool>` uniformly **)** |const| |
  170. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  171. | :ref:`RID[]<class_RID>` | :ref:`map_get_regions<class_NavigationServer2D_method_map_get_regions>` **(** :ref:`RID<class_RID>` map **)** |const| |
  172. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  173. | :ref:`bool<class_bool>` | :ref:`map_get_use_edge_connections<class_NavigationServer2D_method_map_get_use_edge_connections>` **(** :ref:`RID<class_RID>` map **)** |const| |
  174. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  175. | :ref:`bool<class_bool>` | :ref:`map_is_active<class_NavigationServer2D_method_map_is_active>` **(** :ref:`RID<class_RID>` map **)** |const| |
  176. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  177. | void | :ref:`map_set_active<class_NavigationServer2D_method_map_set_active>` **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` active **)** |
  178. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  179. | void | :ref:`map_set_cell_size<class_NavigationServer2D_method_map_set_cell_size>` **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` cell_size **)** |
  180. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  181. | 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 **)** |
  182. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  183. | 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 **)** |
  184. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  185. | 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 **)** |
  186. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  187. | :ref:`RID<class_RID>` | :ref:`obstacle_create<class_NavigationServer2D_method_obstacle_create>` **(** **)** |
  188. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  189. | :ref:`bool<class_bool>` | :ref:`obstacle_get_avoidance_enabled<class_NavigationServer2D_method_obstacle_get_avoidance_enabled>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  190. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  191. | :ref:`int<class_int>` | :ref:`obstacle_get_avoidance_layers<class_NavigationServer2D_method_obstacle_get_avoidance_layers>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  192. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  193. | :ref:`RID<class_RID>` | :ref:`obstacle_get_map<class_NavigationServer2D_method_obstacle_get_map>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  194. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  195. | :ref:`bool<class_bool>` | :ref:`obstacle_get_paused<class_NavigationServer2D_method_obstacle_get_paused>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  196. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  197. | :ref:`Vector2<class_Vector2>` | :ref:`obstacle_get_position<class_NavigationServer2D_method_obstacle_get_position>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  198. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  199. | :ref:`float<class_float>` | :ref:`obstacle_get_radius<class_NavigationServer2D_method_obstacle_get_radius>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  200. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  201. | :ref:`Vector2<class_Vector2>` | :ref:`obstacle_get_velocity<class_NavigationServer2D_method_obstacle_get_velocity>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  202. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  203. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`obstacle_get_vertices<class_NavigationServer2D_method_obstacle_get_vertices>` **(** :ref:`RID<class_RID>` obstacle **)** |const| |
  204. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  205. | void | :ref:`obstacle_set_avoidance_enabled<class_NavigationServer2D_method_obstacle_set_avoidance_enabled>` **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` enabled **)** |
  206. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  207. | void | :ref:`obstacle_set_avoidance_layers<class_NavigationServer2D_method_obstacle_set_avoidance_layers>` **(** :ref:`RID<class_RID>` obstacle, :ref:`int<class_int>` layers **)** |
  208. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  209. | void | :ref:`obstacle_set_map<class_NavigationServer2D_method_obstacle_set_map>` **(** :ref:`RID<class_RID>` obstacle, :ref:`RID<class_RID>` map **)** |
  210. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  211. | void | :ref:`obstacle_set_paused<class_NavigationServer2D_method_obstacle_set_paused>` **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` paused **)** |
  212. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  213. | void | :ref:`obstacle_set_position<class_NavigationServer2D_method_obstacle_set_position>` **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` position **)** |
  214. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  215. | void | :ref:`obstacle_set_radius<class_NavigationServer2D_method_obstacle_set_radius>` **(** :ref:`RID<class_RID>` obstacle, :ref:`float<class_float>` radius **)** |
  216. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  217. | void | :ref:`obstacle_set_velocity<class_NavigationServer2D_method_obstacle_set_velocity>` **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` velocity **)** |
  218. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  219. | void | :ref:`obstacle_set_vertices<class_NavigationServer2D_method_obstacle_set_vertices>` **(** :ref:`RID<class_RID>` obstacle, :ref:`PackedVector2Array<class_PackedVector2Array>` vertices **)** |
  220. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  221. | 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() **)** |
  222. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  223. | void | :ref:`query_path<class_NavigationServer2D_method_query_path>` **(** :ref:`NavigationPathQueryParameters2D<class_NavigationPathQueryParameters2D>` parameters, :ref:`NavigationPathQueryResult2D<class_NavigationPathQueryResult2D>` result **)** |const| |
  224. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  225. | :ref:`RID<class_RID>` | :ref:`region_create<class_NavigationServer2D_method_region_create>` **(** **)** |
  226. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  227. | :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| |
  228. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  229. | :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| |
  230. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  231. | :ref:`int<class_int>` | :ref:`region_get_connections_count<class_NavigationServer2D_method_region_get_connections_count>` **(** :ref:`RID<class_RID>` region **)** |const| |
  232. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  233. | :ref:`bool<class_bool>` | :ref:`region_get_enabled<class_NavigationServer2D_method_region_get_enabled>` **(** :ref:`RID<class_RID>` region **)** |const| |
  234. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  235. | :ref:`float<class_float>` | :ref:`region_get_enter_cost<class_NavigationServer2D_method_region_get_enter_cost>` **(** :ref:`RID<class_RID>` region **)** |const| |
  236. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  237. | :ref:`RID<class_RID>` | :ref:`region_get_map<class_NavigationServer2D_method_region_get_map>` **(** :ref:`RID<class_RID>` region **)** |const| |
  238. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  239. | :ref:`int<class_int>` | :ref:`region_get_navigation_layers<class_NavigationServer2D_method_region_get_navigation_layers>` **(** :ref:`RID<class_RID>` region **)** |const| |
  240. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  241. | :ref:`int<class_int>` | :ref:`region_get_owner_id<class_NavigationServer2D_method_region_get_owner_id>` **(** :ref:`RID<class_RID>` region **)** |const| |
  242. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  243. | :ref:`Vector2<class_Vector2>` | :ref:`region_get_random_point<class_NavigationServer2D_method_region_get_random_point>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` navigation_layers, :ref:`bool<class_bool>` uniformly **)** |const| |
  244. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  245. | :ref:`Transform2D<class_Transform2D>` | :ref:`region_get_transform<class_NavigationServer2D_method_region_get_transform>` **(** :ref:`RID<class_RID>` region **)** |const| |
  246. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  247. | :ref:`float<class_float>` | :ref:`region_get_travel_cost<class_NavigationServer2D_method_region_get_travel_cost>` **(** :ref:`RID<class_RID>` region **)** |const| |
  248. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  249. | :ref:`bool<class_bool>` | :ref:`region_get_use_edge_connections<class_NavigationServer2D_method_region_get_use_edge_connections>` **(** :ref:`RID<class_RID>` region **)** |const| |
  250. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  251. | :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| |
  252. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  253. | void | :ref:`region_set_enabled<class_NavigationServer2D_method_region_set_enabled>` **(** :ref:`RID<class_RID>` region, :ref:`bool<class_bool>` enabled **)** |
  254. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  255. | void | :ref:`region_set_enter_cost<class_NavigationServer2D_method_region_set_enter_cost>` **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` enter_cost **)** |
  256. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  257. | void | :ref:`region_set_map<class_NavigationServer2D_method_region_set_map>` **(** :ref:`RID<class_RID>` region, :ref:`RID<class_RID>` map **)** |
  258. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  259. | void | :ref:`region_set_navigation_layers<class_NavigationServer2D_method_region_set_navigation_layers>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` navigation_layers **)** |
  260. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  261. | void | :ref:`region_set_navigation_polygon<class_NavigationServer2D_method_region_set_navigation_polygon>` **(** :ref:`RID<class_RID>` region, :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon **)** |
  262. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  263. | void | :ref:`region_set_owner_id<class_NavigationServer2D_method_region_set_owner_id>` **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` owner_id **)** |
  264. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  265. | void | :ref:`region_set_transform<class_NavigationServer2D_method_region_set_transform>` **(** :ref:`RID<class_RID>` region, :ref:`Transform2D<class_Transform2D>` transform **)** |
  266. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  267. | void | :ref:`region_set_travel_cost<class_NavigationServer2D_method_region_set_travel_cost>` **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` travel_cost **)** |
  268. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  269. | 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 **)** |
  270. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  271. | void | :ref:`set_debug_enabled<class_NavigationServer2D_method_set_debug_enabled>` **(** :ref:`bool<class_bool>` enabled **)** |
  272. +-----------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  273. .. rst-class:: classref-section-separator
  274. ----
  275. .. rst-class:: classref-descriptions-group
  276. Signals
  277. -------
  278. .. _class_NavigationServer2D_signal_map_changed:
  279. .. rst-class:: classref-signal
  280. **map_changed** **(** :ref:`RID<class_RID>` map **)**
  281. Emitted when a navigation map is updated, when a region moves or is modified.
  282. .. rst-class:: classref-item-separator
  283. ----
  284. .. _class_NavigationServer2D_signal_navigation_debug_changed:
  285. .. rst-class:: classref-signal
  286. **navigation_debug_changed** **(** **)**
  287. Emitted when navigation debug settings are changed. Only available in debug builds.
  288. .. rst-class:: classref-section-separator
  289. ----
  290. .. rst-class:: classref-descriptions-group
  291. Method Descriptions
  292. -------------------
  293. .. _class_NavigationServer2D_method_agent_create:
  294. .. rst-class:: classref-method
  295. :ref:`RID<class_RID>` **agent_create** **(** **)**
  296. Creates the agent.
  297. .. rst-class:: classref-item-separator
  298. ----
  299. .. _class_NavigationServer2D_method_agent_get_avoidance_enabled:
  300. .. rst-class:: classref-method
  301. :ref:`bool<class_bool>` **agent_get_avoidance_enabled** **(** :ref:`RID<class_RID>` agent **)** |const|
  302. Return ``true`` if the specified ``agent`` uses avoidance.
  303. .. rst-class:: classref-item-separator
  304. ----
  305. .. _class_NavigationServer2D_method_agent_get_avoidance_layers:
  306. .. rst-class:: classref-method
  307. :ref:`int<class_int>` **agent_get_avoidance_layers** **(** :ref:`RID<class_RID>` agent **)** |const|
  308. Returns the ``avoidance_layers`` bitmask of the specified ``agent``.
  309. .. rst-class:: classref-item-separator
  310. ----
  311. .. _class_NavigationServer2D_method_agent_get_avoidance_mask:
  312. .. rst-class:: classref-method
  313. :ref:`int<class_int>` **agent_get_avoidance_mask** **(** :ref:`RID<class_RID>` agent **)** |const|
  314. Returns the ``avoidance_mask`` bitmask of the specified ``agent``.
  315. .. rst-class:: classref-item-separator
  316. ----
  317. .. _class_NavigationServer2D_method_agent_get_avoidance_priority:
  318. .. rst-class:: classref-method
  319. :ref:`float<class_float>` **agent_get_avoidance_priority** **(** :ref:`RID<class_RID>` agent **)** |const|
  320. Returns the ``avoidance_priority`` of the specified ``agent``.
  321. .. rst-class:: classref-item-separator
  322. ----
  323. .. _class_NavigationServer2D_method_agent_get_map:
  324. .. rst-class:: classref-method
  325. :ref:`RID<class_RID>` **agent_get_map** **(** :ref:`RID<class_RID>` agent **)** |const|
  326. Returns the navigation map :ref:`RID<class_RID>` the requested ``agent`` is currently assigned to.
  327. .. rst-class:: classref-item-separator
  328. ----
  329. .. _class_NavigationServer2D_method_agent_get_max_neighbors:
  330. .. rst-class:: classref-method
  331. :ref:`int<class_int>` **agent_get_max_neighbors** **(** :ref:`RID<class_RID>` agent **)** |const|
  332. Returns the maximum number of other agents the specified ``agent`` takes into account in the navigation.
  333. .. rst-class:: classref-item-separator
  334. ----
  335. .. _class_NavigationServer2D_method_agent_get_max_speed:
  336. .. rst-class:: classref-method
  337. :ref:`float<class_float>` **agent_get_max_speed** **(** :ref:`RID<class_RID>` agent **)** |const|
  338. Returns the maximum speed of the specified ``agent``.
  339. .. rst-class:: classref-item-separator
  340. ----
  341. .. _class_NavigationServer2D_method_agent_get_neighbor_distance:
  342. .. rst-class:: classref-method
  343. :ref:`float<class_float>` **agent_get_neighbor_distance** **(** :ref:`RID<class_RID>` agent **)** |const|
  344. Returns the maximum distance to other agents the specified ``agent`` takes into account in the navigation.
  345. .. rst-class:: classref-item-separator
  346. ----
  347. .. _class_NavigationServer2D_method_agent_get_paused:
  348. .. rst-class:: classref-method
  349. :ref:`bool<class_bool>` **agent_get_paused** **(** :ref:`RID<class_RID>` agent **)** |const|
  350. Returns ``true`` if the specified ``agent`` is paused.
  351. .. rst-class:: classref-item-separator
  352. ----
  353. .. _class_NavigationServer2D_method_agent_get_position:
  354. .. rst-class:: classref-method
  355. :ref:`Vector2<class_Vector2>` **agent_get_position** **(** :ref:`RID<class_RID>` agent **)** |const|
  356. Returns the position of the specified ``agent`` in world space.
  357. .. rst-class:: classref-item-separator
  358. ----
  359. .. _class_NavigationServer2D_method_agent_get_radius:
  360. .. rst-class:: classref-method
  361. :ref:`float<class_float>` **agent_get_radius** **(** :ref:`RID<class_RID>` agent **)** |const|
  362. Returns the radius of the specified ``agent``.
  363. .. rst-class:: classref-item-separator
  364. ----
  365. .. _class_NavigationServer2D_method_agent_get_time_horizon_agents:
  366. .. rst-class:: classref-method
  367. :ref:`float<class_float>` **agent_get_time_horizon_agents** **(** :ref:`RID<class_RID>` agent **)** |const|
  368. Returns the minimal amount of time for which the specified ``agent``'s velocities that are computed by the simulation are safe with respect to other agents.
  369. .. rst-class:: classref-item-separator
  370. ----
  371. .. _class_NavigationServer2D_method_agent_get_time_horizon_obstacles:
  372. .. rst-class:: classref-method
  373. :ref:`float<class_float>` **agent_get_time_horizon_obstacles** **(** :ref:`RID<class_RID>` agent **)** |const|
  374. Returns the minimal amount of time for which the specified ``agent``'s velocities that are computed by the simulation are safe with respect to static avoidance obstacles.
  375. .. rst-class:: classref-item-separator
  376. ----
  377. .. _class_NavigationServer2D_method_agent_get_velocity:
  378. .. rst-class:: classref-method
  379. :ref:`Vector2<class_Vector2>` **agent_get_velocity** **(** :ref:`RID<class_RID>` agent **)** |const|
  380. Returns the velocity of the specified ``agent``.
  381. .. rst-class:: classref-item-separator
  382. ----
  383. .. _class_NavigationServer2D_method_agent_has_avoidance_callback:
  384. .. rst-class:: classref-method
  385. :ref:`bool<class_bool>` **agent_has_avoidance_callback** **(** :ref:`RID<class_RID>` agent **)** |const|
  386. Return ``true`` if the specified ``agent`` has an avoidance callback.
  387. .. rst-class:: classref-item-separator
  388. ----
  389. .. _class_NavigationServer2D_method_agent_is_map_changed:
  390. .. rst-class:: classref-method
  391. :ref:`bool<class_bool>` **agent_is_map_changed** **(** :ref:`RID<class_RID>` agent **)** |const|
  392. Returns true if the map got changed the previous frame.
  393. .. rst-class:: classref-item-separator
  394. ----
  395. .. _class_NavigationServer2D_method_agent_set_avoidance_callback:
  396. .. rst-class:: classref-method
  397. void **agent_set_avoidance_callback** **(** :ref:`RID<class_RID>` agent, :ref:`Callable<class_Callable>` callback **)**
  398. 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.
  399. \ **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>`.
  400. .. rst-class:: classref-item-separator
  401. ----
  402. .. _class_NavigationServer2D_method_agent_set_avoidance_enabled:
  403. .. rst-class:: classref-method
  404. void **agent_set_avoidance_enabled** **(** :ref:`RID<class_RID>` agent, :ref:`bool<class_bool>` enabled **)**
  405. If ``enabled`` is ``true``, the specified ``agent`` uses avoidance.
  406. .. rst-class:: classref-item-separator
  407. ----
  408. .. _class_NavigationServer2D_method_agent_set_avoidance_layers:
  409. .. rst-class:: classref-method
  410. void **agent_set_avoidance_layers** **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` layers **)**
  411. Set the agent's ``avoidance_layers`` bitmask.
  412. .. rst-class:: classref-item-separator
  413. ----
  414. .. _class_NavigationServer2D_method_agent_set_avoidance_mask:
  415. .. rst-class:: classref-method
  416. void **agent_set_avoidance_mask** **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` mask **)**
  417. Set the agent's ``avoidance_mask`` bitmask.
  418. .. rst-class:: classref-item-separator
  419. ----
  420. .. _class_NavigationServer2D_method_agent_set_avoidance_priority:
  421. .. rst-class:: classref-method
  422. void **agent_set_avoidance_priority** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` priority **)**
  423. Set the agent's ``avoidance_priority`` with a ``priority`` between 0.0 (lowest priority) to 1.0 (highest priority).
  424. 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.
  425. .. rst-class:: classref-item-separator
  426. ----
  427. .. _class_NavigationServer2D_method_agent_set_map:
  428. .. rst-class:: classref-method
  429. void **agent_set_map** **(** :ref:`RID<class_RID>` agent, :ref:`RID<class_RID>` map **)**
  430. Puts the agent in the map.
  431. .. rst-class:: classref-item-separator
  432. ----
  433. .. _class_NavigationServer2D_method_agent_set_max_neighbors:
  434. .. rst-class:: classref-method
  435. void **agent_set_max_neighbors** **(** :ref:`RID<class_RID>` agent, :ref:`int<class_int>` count **)**
  436. 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.
  437. .. rst-class:: classref-item-separator
  438. ----
  439. .. _class_NavigationServer2D_method_agent_set_max_speed:
  440. .. rst-class:: classref-method
  441. void **agent_set_max_speed** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` max_speed **)**
  442. Sets the maximum speed of the agent. Must be positive.
  443. .. rst-class:: classref-item-separator
  444. ----
  445. .. _class_NavigationServer2D_method_agent_set_neighbor_distance:
  446. .. rst-class:: classref-method
  447. void **agent_set_neighbor_distance** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` distance **)**
  448. 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.
  449. .. rst-class:: classref-item-separator
  450. ----
  451. .. _class_NavigationServer2D_method_agent_set_paused:
  452. .. rst-class:: classref-method
  453. void **agent_set_paused** **(** :ref:`RID<class_RID>` agent, :ref:`bool<class_bool>` paused **)**
  454. If ``paused`` is true the specified ``agent`` will not be processed, e.g. calculate avoidance velocities or receive avoidance callbacks.
  455. .. rst-class:: classref-item-separator
  456. ----
  457. .. _class_NavigationServer2D_method_agent_set_position:
  458. .. rst-class:: classref-method
  459. void **agent_set_position** **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` position **)**
  460. Sets the position of the agent in world space.
  461. .. rst-class:: classref-item-separator
  462. ----
  463. .. _class_NavigationServer2D_method_agent_set_radius:
  464. .. rst-class:: classref-method
  465. void **agent_set_radius** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` radius **)**
  466. Sets the radius of the agent.
  467. .. rst-class:: classref-item-separator
  468. ----
  469. .. _class_NavigationServer2D_method_agent_set_time_horizon_agents:
  470. .. rst-class:: classref-method
  471. void **agent_set_time_horizon_agents** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time_horizon **)**
  472. 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.
  473. .. rst-class:: classref-item-separator
  474. ----
  475. .. _class_NavigationServer2D_method_agent_set_time_horizon_obstacles:
  476. .. rst-class:: classref-method
  477. void **agent_set_time_horizon_obstacles** **(** :ref:`RID<class_RID>` agent, :ref:`float<class_float>` time_horizon **)**
  478. 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.
  479. .. rst-class:: classref-item-separator
  480. ----
  481. .. _class_NavigationServer2D_method_agent_set_velocity:
  482. .. rst-class:: classref-method
  483. void **agent_set_velocity** **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)**
  484. 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.
  485. .. rst-class:: classref-item-separator
  486. ----
  487. .. _class_NavigationServer2D_method_agent_set_velocity_forced:
  488. .. rst-class:: classref-method
  489. void **agent_set_velocity_forced** **(** :ref:`RID<class_RID>` agent, :ref:`Vector2<class_Vector2>` velocity **)**
  490. 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.
  491. .. rst-class:: classref-item-separator
  492. ----
  493. .. _class_NavigationServer2D_method_bake_from_source_geometry_data:
  494. .. rst-class:: classref-method
  495. 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() **)**
  496. 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.
  497. .. rst-class:: classref-item-separator
  498. ----
  499. .. _class_NavigationServer2D_method_bake_from_source_geometry_data_async:
  500. .. rst-class:: classref-method
  501. 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() **)**
  502. 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.
  503. .. rst-class:: classref-item-separator
  504. ----
  505. .. _class_NavigationServer2D_method_free_rid:
  506. .. rst-class:: classref-method
  507. void **free_rid** **(** :ref:`RID<class_RID>` rid **)**
  508. Destroys the given RID.
  509. .. rst-class:: classref-item-separator
  510. ----
  511. .. _class_NavigationServer2D_method_get_debug_enabled:
  512. .. rst-class:: classref-method
  513. :ref:`bool<class_bool>` **get_debug_enabled** **(** **)** |const|
  514. Returns ``true`` when the NavigationServer has debug enabled.
  515. .. rst-class:: classref-item-separator
  516. ----
  517. .. _class_NavigationServer2D_method_get_maps:
  518. .. rst-class:: classref-method
  519. :ref:`RID[]<class_RID>` **get_maps** **(** **)** |const|
  520. 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.
  521. .. rst-class:: classref-item-separator
  522. ----
  523. .. _class_NavigationServer2D_method_link_create:
  524. .. rst-class:: classref-method
  525. :ref:`RID<class_RID>` **link_create** **(** **)**
  526. Create a new link between two positions on a map.
  527. .. rst-class:: classref-item-separator
  528. ----
  529. .. _class_NavigationServer2D_method_link_get_enabled:
  530. .. rst-class:: classref-method
  531. :ref:`bool<class_bool>` **link_get_enabled** **(** :ref:`RID<class_RID>` link **)** |const|
  532. Returns ``true`` if the specified ``link`` is enabled.
  533. .. rst-class:: classref-item-separator
  534. ----
  535. .. _class_NavigationServer2D_method_link_get_end_position:
  536. .. rst-class:: classref-method
  537. :ref:`Vector2<class_Vector2>` **link_get_end_position** **(** :ref:`RID<class_RID>` link **)** |const|
  538. Returns the ending position of this ``link``.
  539. .. rst-class:: classref-item-separator
  540. ----
  541. .. _class_NavigationServer2D_method_link_get_enter_cost:
  542. .. rst-class:: classref-method
  543. :ref:`float<class_float>` **link_get_enter_cost** **(** :ref:`RID<class_RID>` link **)** |const|
  544. Returns the enter cost of this ``link``.
  545. .. rst-class:: classref-item-separator
  546. ----
  547. .. _class_NavigationServer2D_method_link_get_map:
  548. .. rst-class:: classref-method
  549. :ref:`RID<class_RID>` **link_get_map** **(** :ref:`RID<class_RID>` link **)** |const|
  550. Returns the navigation map :ref:`RID<class_RID>` the requested ``link`` is currently assigned to.
  551. .. rst-class:: classref-item-separator
  552. ----
  553. .. _class_NavigationServer2D_method_link_get_navigation_layers:
  554. .. rst-class:: classref-method
  555. :ref:`int<class_int>` **link_get_navigation_layers** **(** :ref:`RID<class_RID>` link **)** |const|
  556. Returns the navigation layers for this ``link``.
  557. .. rst-class:: classref-item-separator
  558. ----
  559. .. _class_NavigationServer2D_method_link_get_owner_id:
  560. .. rst-class:: classref-method
  561. :ref:`int<class_int>` **link_get_owner_id** **(** :ref:`RID<class_RID>` link **)** |const|
  562. Returns the ``ObjectID`` of the object which manages this link.
  563. .. rst-class:: classref-item-separator
  564. ----
  565. .. _class_NavigationServer2D_method_link_get_start_position:
  566. .. rst-class:: classref-method
  567. :ref:`Vector2<class_Vector2>` **link_get_start_position** **(** :ref:`RID<class_RID>` link **)** |const|
  568. Returns the starting position of this ``link``.
  569. .. rst-class:: classref-item-separator
  570. ----
  571. .. _class_NavigationServer2D_method_link_get_travel_cost:
  572. .. rst-class:: classref-method
  573. :ref:`float<class_float>` **link_get_travel_cost** **(** :ref:`RID<class_RID>` link **)** |const|
  574. Returns the travel cost of this ``link``.
  575. .. rst-class:: classref-item-separator
  576. ----
  577. .. _class_NavigationServer2D_method_link_is_bidirectional:
  578. .. rst-class:: classref-method
  579. :ref:`bool<class_bool>` **link_is_bidirectional** **(** :ref:`RID<class_RID>` link **)** |const|
  580. Returns whether this ``link`` can be travelled in both directions.
  581. .. rst-class:: classref-item-separator
  582. ----
  583. .. _class_NavigationServer2D_method_link_set_bidirectional:
  584. .. rst-class:: classref-method
  585. void **link_set_bidirectional** **(** :ref:`RID<class_RID>` link, :ref:`bool<class_bool>` bidirectional **)**
  586. Sets whether this ``link`` can be travelled in both directions.
  587. .. rst-class:: classref-item-separator
  588. ----
  589. .. _class_NavigationServer2D_method_link_set_enabled:
  590. .. rst-class:: classref-method
  591. void **link_set_enabled** **(** :ref:`RID<class_RID>` link, :ref:`bool<class_bool>` enabled **)**
  592. If ``enabled`` is ``true``, the specified ``link`` will contribute to its current navigation map.
  593. .. rst-class:: classref-item-separator
  594. ----
  595. .. _class_NavigationServer2D_method_link_set_end_position:
  596. .. rst-class:: classref-method
  597. void **link_set_end_position** **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)**
  598. Sets the exit position for the ``link``.
  599. .. rst-class:: classref-item-separator
  600. ----
  601. .. _class_NavigationServer2D_method_link_set_enter_cost:
  602. .. rst-class:: classref-method
  603. void **link_set_enter_cost** **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` enter_cost **)**
  604. Sets the ``enter_cost`` for this ``link``.
  605. .. rst-class:: classref-item-separator
  606. ----
  607. .. _class_NavigationServer2D_method_link_set_map:
  608. .. rst-class:: classref-method
  609. void **link_set_map** **(** :ref:`RID<class_RID>` link, :ref:`RID<class_RID>` map **)**
  610. Sets the navigation map :ref:`RID<class_RID>` for the link.
  611. .. rst-class:: classref-item-separator
  612. ----
  613. .. _class_NavigationServer2D_method_link_set_navigation_layers:
  614. .. rst-class:: classref-method
  615. void **link_set_navigation_layers** **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` navigation_layers **)**
  616. 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>`).
  617. .. rst-class:: classref-item-separator
  618. ----
  619. .. _class_NavigationServer2D_method_link_set_owner_id:
  620. .. rst-class:: classref-method
  621. void **link_set_owner_id** **(** :ref:`RID<class_RID>` link, :ref:`int<class_int>` owner_id **)**
  622. Set the ``ObjectID`` of the object which manages this link.
  623. .. rst-class:: classref-item-separator
  624. ----
  625. .. _class_NavigationServer2D_method_link_set_start_position:
  626. .. rst-class:: classref-method
  627. void **link_set_start_position** **(** :ref:`RID<class_RID>` link, :ref:`Vector2<class_Vector2>` position **)**
  628. Sets the entry position for this ``link``.
  629. .. rst-class:: classref-item-separator
  630. ----
  631. .. _class_NavigationServer2D_method_link_set_travel_cost:
  632. .. rst-class:: classref-method
  633. void **link_set_travel_cost** **(** :ref:`RID<class_RID>` link, :ref:`float<class_float>` travel_cost **)**
  634. Sets the ``travel_cost`` for this ``link``.
  635. .. rst-class:: classref-item-separator
  636. ----
  637. .. _class_NavigationServer2D_method_map_create:
  638. .. rst-class:: classref-method
  639. :ref:`RID<class_RID>` **map_create** **(** **)**
  640. Create a new map.
  641. .. rst-class:: classref-item-separator
  642. ----
  643. .. _class_NavigationServer2D_method_map_force_update:
  644. .. rst-class:: classref-method
  645. void **map_force_update** **(** :ref:`RID<class_RID>` map **)**
  646. 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).
  647. 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.
  648. Avoidance processing and dispatch of the ``safe_velocity`` signals is untouched by this function and continues to happen for all maps and agents at the end of the physics frame.
  649. \ **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.
  650. .. rst-class:: classref-item-separator
  651. ----
  652. .. _class_NavigationServer2D_method_map_get_agents:
  653. .. rst-class:: classref-method
  654. :ref:`RID[]<class_RID>` **map_get_agents** **(** :ref:`RID<class_RID>` map **)** |const|
  655. Returns all navigation agents :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  656. .. rst-class:: classref-item-separator
  657. ----
  658. .. _class_NavigationServer2D_method_map_get_cell_size:
  659. .. rst-class:: classref-method
  660. :ref:`float<class_float>` **map_get_cell_size** **(** :ref:`RID<class_RID>` map **)** |const|
  661. Returns the map cell size used to rasterize the navigation mesh vertices.
  662. .. rst-class:: classref-item-separator
  663. ----
  664. .. _class_NavigationServer2D_method_map_get_closest_point:
  665. .. rst-class:: classref-method
  666. :ref:`Vector2<class_Vector2>` **map_get_closest_point** **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` to_point **)** |const|
  667. Returns the point closest to the provided ``to_point`` on the navigation mesh surface.
  668. .. rst-class:: classref-item-separator
  669. ----
  670. .. _class_NavigationServer2D_method_map_get_closest_point_owner:
  671. .. rst-class:: classref-method
  672. :ref:`RID<class_RID>` **map_get_closest_point_owner** **(** :ref:`RID<class_RID>` map, :ref:`Vector2<class_Vector2>` to_point **)** |const|
  673. Returns the owner region RID for the point returned by :ref:`map_get_closest_point<class_NavigationServer2D_method_map_get_closest_point>`.
  674. .. rst-class:: classref-item-separator
  675. ----
  676. .. _class_NavigationServer2D_method_map_get_edge_connection_margin:
  677. .. rst-class:: classref-method
  678. :ref:`float<class_float>` **map_get_edge_connection_margin** **(** :ref:`RID<class_RID>` map **)** |const|
  679. Returns the edge connection margin of the map. The edge connection margin is a distance used to connect two regions.
  680. .. rst-class:: classref-item-separator
  681. ----
  682. .. _class_NavigationServer2D_method_map_get_link_connection_radius:
  683. .. rst-class:: classref-method
  684. :ref:`float<class_float>` **map_get_link_connection_radius** **(** :ref:`RID<class_RID>` map **)** |const|
  685. 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.
  686. .. rst-class:: classref-item-separator
  687. ----
  688. .. _class_NavigationServer2D_method_map_get_links:
  689. .. rst-class:: classref-method
  690. :ref:`RID[]<class_RID>` **map_get_links** **(** :ref:`RID<class_RID>` map **)** |const|
  691. Returns all navigation link :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  692. .. rst-class:: classref-item-separator
  693. ----
  694. .. _class_NavigationServer2D_method_map_get_obstacles:
  695. .. rst-class:: classref-method
  696. :ref:`RID[]<class_RID>` **map_get_obstacles** **(** :ref:`RID<class_RID>` map **)** |const|
  697. Returns all navigation obstacle :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  698. .. rst-class:: classref-item-separator
  699. ----
  700. .. _class_NavigationServer2D_method_map_get_path:
  701. .. rst-class:: classref-method
  702. :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|
  703. 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.
  704. .. rst-class:: classref-item-separator
  705. ----
  706. .. _class_NavigationServer2D_method_map_get_random_point:
  707. .. rst-class:: classref-method
  708. :ref:`Vector2<class_Vector2>` **map_get_random_point** **(** :ref:`RID<class_RID>` map, :ref:`int<class_int>` navigation_layers, :ref:`bool<class_bool>` uniformly **)** |const|
  709. Returns a random position picked from all map region polygons with matching ``navigation_layers``.
  710. If ``uniformly`` is ``true``, all map regions, polygons, and faces are weighted by their surface area (slower).
  711. If ``uniformly`` is ``false``, just a random region and a random polygon are picked (faster).
  712. .. rst-class:: classref-item-separator
  713. ----
  714. .. _class_NavigationServer2D_method_map_get_regions:
  715. .. rst-class:: classref-method
  716. :ref:`RID[]<class_RID>` **map_get_regions** **(** :ref:`RID<class_RID>` map **)** |const|
  717. Returns all navigation regions :ref:`RID<class_RID>`\ s that are currently assigned to the requested navigation ``map``.
  718. .. rst-class:: classref-item-separator
  719. ----
  720. .. _class_NavigationServer2D_method_map_get_use_edge_connections:
  721. .. rst-class:: classref-method
  722. :ref:`bool<class_bool>` **map_get_use_edge_connections** **(** :ref:`RID<class_RID>` map **)** |const|
  723. 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.
  724. .. rst-class:: classref-item-separator
  725. ----
  726. .. _class_NavigationServer2D_method_map_is_active:
  727. .. rst-class:: classref-method
  728. :ref:`bool<class_bool>` **map_is_active** **(** :ref:`RID<class_RID>` map **)** |const|
  729. Returns true if the map is active.
  730. .. rst-class:: classref-item-separator
  731. ----
  732. .. _class_NavigationServer2D_method_map_set_active:
  733. .. rst-class:: classref-method
  734. void **map_set_active** **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` active **)**
  735. Sets the map active.
  736. .. rst-class:: classref-item-separator
  737. ----
  738. .. _class_NavigationServer2D_method_map_set_cell_size:
  739. .. rst-class:: classref-method
  740. void **map_set_cell_size** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` cell_size **)**
  741. Sets the map cell size used to rasterize the navigation mesh vertices. Must match with the cell size of the used navigation meshes.
  742. .. rst-class:: classref-item-separator
  743. ----
  744. .. _class_NavigationServer2D_method_map_set_edge_connection_margin:
  745. .. rst-class:: classref-method
  746. void **map_set_edge_connection_margin** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` margin **)**
  747. Set the map edge connection margin used to weld the compatible region edges.
  748. .. rst-class:: classref-item-separator
  749. ----
  750. .. _class_NavigationServer2D_method_map_set_link_connection_radius:
  751. .. rst-class:: classref-method
  752. void **map_set_link_connection_radius** **(** :ref:`RID<class_RID>` map, :ref:`float<class_float>` radius **)**
  753. Set the map's link connection radius used to connect links to navigation polygons.
  754. .. rst-class:: classref-item-separator
  755. ----
  756. .. _class_NavigationServer2D_method_map_set_use_edge_connections:
  757. .. rst-class:: classref-method
  758. void **map_set_use_edge_connections** **(** :ref:`RID<class_RID>` map, :ref:`bool<class_bool>` enabled **)**
  759. 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.
  760. .. rst-class:: classref-item-separator
  761. ----
  762. .. _class_NavigationServer2D_method_obstacle_create:
  763. .. rst-class:: classref-method
  764. :ref:`RID<class_RID>` **obstacle_create** **(** **)**
  765. Creates a new navigation obstacle.
  766. .. rst-class:: classref-item-separator
  767. ----
  768. .. _class_NavigationServer2D_method_obstacle_get_avoidance_enabled:
  769. .. rst-class:: classref-method
  770. :ref:`bool<class_bool>` **obstacle_get_avoidance_enabled** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  771. Returns ``true`` if the provided ``obstacle`` has avoidance enabled.
  772. .. rst-class:: classref-item-separator
  773. ----
  774. .. _class_NavigationServer2D_method_obstacle_get_avoidance_layers:
  775. .. rst-class:: classref-method
  776. :ref:`int<class_int>` **obstacle_get_avoidance_layers** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  777. Returns the ``avoidance_layers`` bitmask of the specified ``obstacle``.
  778. .. rst-class:: classref-item-separator
  779. ----
  780. .. _class_NavigationServer2D_method_obstacle_get_map:
  781. .. rst-class:: classref-method
  782. :ref:`RID<class_RID>` **obstacle_get_map** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  783. Returns the navigation map :ref:`RID<class_RID>` the requested ``obstacle`` is currently assigned to.
  784. .. rst-class:: classref-item-separator
  785. ----
  786. .. _class_NavigationServer2D_method_obstacle_get_paused:
  787. .. rst-class:: classref-method
  788. :ref:`bool<class_bool>` **obstacle_get_paused** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  789. Returns ``true`` if the specified ``obstacle`` is paused.
  790. .. rst-class:: classref-item-separator
  791. ----
  792. .. _class_NavigationServer2D_method_obstacle_get_position:
  793. .. rst-class:: classref-method
  794. :ref:`Vector2<class_Vector2>` **obstacle_get_position** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  795. Returns the position of the specified ``obstacle`` in world space.
  796. .. rst-class:: classref-item-separator
  797. ----
  798. .. _class_NavigationServer2D_method_obstacle_get_radius:
  799. .. rst-class:: classref-method
  800. :ref:`float<class_float>` **obstacle_get_radius** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  801. Returns the radius of the specified dynamic ``obstacle``.
  802. .. rst-class:: classref-item-separator
  803. ----
  804. .. _class_NavigationServer2D_method_obstacle_get_velocity:
  805. .. rst-class:: classref-method
  806. :ref:`Vector2<class_Vector2>` **obstacle_get_velocity** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  807. Returns the velocity of the specified dynamic ``obstacle``.
  808. .. rst-class:: classref-item-separator
  809. ----
  810. .. _class_NavigationServer2D_method_obstacle_get_vertices:
  811. .. rst-class:: classref-method
  812. :ref:`PackedVector2Array<class_PackedVector2Array>` **obstacle_get_vertices** **(** :ref:`RID<class_RID>` obstacle **)** |const|
  813. Returns the outline vertices for the specified ``obstacle``.
  814. .. rst-class:: classref-item-separator
  815. ----
  816. .. _class_NavigationServer2D_method_obstacle_set_avoidance_enabled:
  817. .. rst-class:: classref-method
  818. void **obstacle_set_avoidance_enabled** **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` enabled **)**
  819. If ``enabled`` is ``true``, the provided ``obstacle`` affects avoidance using agents.
  820. .. rst-class:: classref-item-separator
  821. ----
  822. .. _class_NavigationServer2D_method_obstacle_set_avoidance_layers:
  823. .. rst-class:: classref-method
  824. void **obstacle_set_avoidance_layers** **(** :ref:`RID<class_RID>` obstacle, :ref:`int<class_int>` layers **)**
  825. Set the obstacles's ``avoidance_layers`` bitmask.
  826. .. rst-class:: classref-item-separator
  827. ----
  828. .. _class_NavigationServer2D_method_obstacle_set_map:
  829. .. rst-class:: classref-method
  830. void **obstacle_set_map** **(** :ref:`RID<class_RID>` obstacle, :ref:`RID<class_RID>` map **)**
  831. Sets the navigation map :ref:`RID<class_RID>` for the obstacle.
  832. .. rst-class:: classref-item-separator
  833. ----
  834. .. _class_NavigationServer2D_method_obstacle_set_paused:
  835. .. rst-class:: classref-method
  836. void **obstacle_set_paused** **(** :ref:`RID<class_RID>` obstacle, :ref:`bool<class_bool>` paused **)**
  837. If ``paused`` is true the specified ``obstacle`` will not be processed, e.g. affect avoidance velocities.
  838. .. rst-class:: classref-item-separator
  839. ----
  840. .. _class_NavigationServer2D_method_obstacle_set_position:
  841. .. rst-class:: classref-method
  842. void **obstacle_set_position** **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` position **)**
  843. Sets the position of the obstacle in world space.
  844. .. rst-class:: classref-item-separator
  845. ----
  846. .. _class_NavigationServer2D_method_obstacle_set_radius:
  847. .. rst-class:: classref-method
  848. void **obstacle_set_radius** **(** :ref:`RID<class_RID>` obstacle, :ref:`float<class_float>` radius **)**
  849. Sets the radius of the dynamic obstacle.
  850. .. rst-class:: classref-item-separator
  851. ----
  852. .. _class_NavigationServer2D_method_obstacle_set_velocity:
  853. .. rst-class:: classref-method
  854. void **obstacle_set_velocity** **(** :ref:`RID<class_RID>` obstacle, :ref:`Vector2<class_Vector2>` velocity **)**
  855. 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.
  856. .. rst-class:: classref-item-separator
  857. ----
  858. .. _class_NavigationServer2D_method_obstacle_set_vertices:
  859. .. rst-class:: classref-method
  860. void **obstacle_set_vertices** **(** :ref:`RID<class_RID>` obstacle, :ref:`PackedVector2Array<class_PackedVector2Array>` vertices **)**
  861. 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.
  862. .. rst-class:: classref-item-separator
  863. ----
  864. .. _class_NavigationServer2D_method_parse_source_geometry_data:
  865. .. rst-class:: classref-method
  866. 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() **)**
  867. 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.
  868. \ **Note:** This function needs to run on the main thread or with a deferred call as the SceneTree is not thread-safe.
  869. \ **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.
  870. .. rst-class:: classref-item-separator
  871. ----
  872. .. _class_NavigationServer2D_method_query_path:
  873. .. rst-class:: classref-method
  874. void **query_path** **(** :ref:`NavigationPathQueryParameters2D<class_NavigationPathQueryParameters2D>` parameters, :ref:`NavigationPathQueryResult2D<class_NavigationPathQueryResult2D>` result **)** |const|
  875. 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.
  876. .. rst-class:: classref-item-separator
  877. ----
  878. .. _class_NavigationServer2D_method_region_create:
  879. .. rst-class:: classref-method
  880. :ref:`RID<class_RID>` **region_create** **(** **)**
  881. Creates a new region.
  882. .. rst-class:: classref-item-separator
  883. ----
  884. .. _class_NavigationServer2D_method_region_get_connection_pathway_end:
  885. .. rst-class:: classref-method
  886. :ref:`Vector2<class_Vector2>` **region_get_connection_pathway_end** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` connection **)** |const|
  887. 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>`.
  888. .. rst-class:: classref-item-separator
  889. ----
  890. .. _class_NavigationServer2D_method_region_get_connection_pathway_start:
  891. .. rst-class:: classref-method
  892. :ref:`Vector2<class_Vector2>` **region_get_connection_pathway_start** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` connection **)** |const|
  893. 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>`.
  894. .. rst-class:: classref-item-separator
  895. ----
  896. .. _class_NavigationServer2D_method_region_get_connections_count:
  897. .. rst-class:: classref-method
  898. :ref:`int<class_int>` **region_get_connections_count** **(** :ref:`RID<class_RID>` region **)** |const|
  899. Returns how many connections this ``region`` has with other regions in the map.
  900. .. rst-class:: classref-item-separator
  901. ----
  902. .. _class_NavigationServer2D_method_region_get_enabled:
  903. .. rst-class:: classref-method
  904. :ref:`bool<class_bool>` **region_get_enabled** **(** :ref:`RID<class_RID>` region **)** |const|
  905. Returns ``true`` if the specified ``region`` is enabled.
  906. .. rst-class:: classref-item-separator
  907. ----
  908. .. _class_NavigationServer2D_method_region_get_enter_cost:
  909. .. rst-class:: classref-method
  910. :ref:`float<class_float>` **region_get_enter_cost** **(** :ref:`RID<class_RID>` region **)** |const|
  911. Returns the enter cost of this ``region``.
  912. .. rst-class:: classref-item-separator
  913. ----
  914. .. _class_NavigationServer2D_method_region_get_map:
  915. .. rst-class:: classref-method
  916. :ref:`RID<class_RID>` **region_get_map** **(** :ref:`RID<class_RID>` region **)** |const|
  917. Returns the navigation map :ref:`RID<class_RID>` the requested ``region`` is currently assigned to.
  918. .. rst-class:: classref-item-separator
  919. ----
  920. .. _class_NavigationServer2D_method_region_get_navigation_layers:
  921. .. rst-class:: classref-method
  922. :ref:`int<class_int>` **region_get_navigation_layers** **(** :ref:`RID<class_RID>` region **)** |const|
  923. Returns the region's navigation layers.
  924. .. rst-class:: classref-item-separator
  925. ----
  926. .. _class_NavigationServer2D_method_region_get_owner_id:
  927. .. rst-class:: classref-method
  928. :ref:`int<class_int>` **region_get_owner_id** **(** :ref:`RID<class_RID>` region **)** |const|
  929. Returns the ``ObjectID`` of the object which manages this region.
  930. .. rst-class:: classref-item-separator
  931. ----
  932. .. _class_NavigationServer2D_method_region_get_random_point:
  933. .. rst-class:: classref-method
  934. :ref:`Vector2<class_Vector2>` **region_get_random_point** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` navigation_layers, :ref:`bool<class_bool>` uniformly **)** |const|
  935. Returns a random position picked from all region polygons with matching ``navigation_layers``.
  936. If ``uniformly`` is ``true``, all region polygons and faces are weighted by their surface area (slower).
  937. If ``uniformly`` is ``false``, just a random polygon and face is picked (faster).
  938. .. rst-class:: classref-item-separator
  939. ----
  940. .. _class_NavigationServer2D_method_region_get_transform:
  941. .. rst-class:: classref-method
  942. :ref:`Transform2D<class_Transform2D>` **region_get_transform** **(** :ref:`RID<class_RID>` region **)** |const|
  943. Returns the global transformation of this ``region``.
  944. .. rst-class:: classref-item-separator
  945. ----
  946. .. _class_NavigationServer2D_method_region_get_travel_cost:
  947. .. rst-class:: classref-method
  948. :ref:`float<class_float>` **region_get_travel_cost** **(** :ref:`RID<class_RID>` region **)** |const|
  949. Returns the travel cost of this ``region``.
  950. .. rst-class:: classref-item-separator
  951. ----
  952. .. _class_NavigationServer2D_method_region_get_use_edge_connections:
  953. .. rst-class:: classref-method
  954. :ref:`bool<class_bool>` **region_get_use_edge_connections** **(** :ref:`RID<class_RID>` region **)** |const|
  955. 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.
  956. .. rst-class:: classref-item-separator
  957. ----
  958. .. _class_NavigationServer2D_method_region_owns_point:
  959. .. rst-class:: classref-method
  960. :ref:`bool<class_bool>` **region_owns_point** **(** :ref:`RID<class_RID>` region, :ref:`Vector2<class_Vector2>` point **)** |const|
  961. 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.
  962. 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.
  963. \ **Note:** If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected.
  964. .. rst-class:: classref-item-separator
  965. ----
  966. .. _class_NavigationServer2D_method_region_set_enabled:
  967. .. rst-class:: classref-method
  968. void **region_set_enabled** **(** :ref:`RID<class_RID>` region, :ref:`bool<class_bool>` enabled **)**
  969. If ``enabled`` is ``true`` the specified ``region`` will contribute to its current navigation map.
  970. .. rst-class:: classref-item-separator
  971. ----
  972. .. _class_NavigationServer2D_method_region_set_enter_cost:
  973. .. rst-class:: classref-method
  974. void **region_set_enter_cost** **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` enter_cost **)**
  975. Sets the ``enter_cost`` for this ``region``.
  976. .. rst-class:: classref-item-separator
  977. ----
  978. .. _class_NavigationServer2D_method_region_set_map:
  979. .. rst-class:: classref-method
  980. void **region_set_map** **(** :ref:`RID<class_RID>` region, :ref:`RID<class_RID>` map **)**
  981. Sets the map for the region.
  982. .. rst-class:: classref-item-separator
  983. ----
  984. .. _class_NavigationServer2D_method_region_set_navigation_layers:
  985. .. rst-class:: classref-method
  986. void **region_set_navigation_layers** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` navigation_layers **)**
  987. 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>`).
  988. .. rst-class:: classref-item-separator
  989. ----
  990. .. _class_NavigationServer2D_method_region_set_navigation_polygon:
  991. .. rst-class:: classref-method
  992. void **region_set_navigation_polygon** **(** :ref:`RID<class_RID>` region, :ref:`NavigationPolygon<class_NavigationPolygon>` navigation_polygon **)**
  993. Sets the ``navigation_polygon`` for the region.
  994. .. rst-class:: classref-item-separator
  995. ----
  996. .. _class_NavigationServer2D_method_region_set_owner_id:
  997. .. rst-class:: classref-method
  998. void **region_set_owner_id** **(** :ref:`RID<class_RID>` region, :ref:`int<class_int>` owner_id **)**
  999. Set the ``ObjectID`` of the object which manages this region.
  1000. .. rst-class:: classref-item-separator
  1001. ----
  1002. .. _class_NavigationServer2D_method_region_set_transform:
  1003. .. rst-class:: classref-method
  1004. void **region_set_transform** **(** :ref:`RID<class_RID>` region, :ref:`Transform2D<class_Transform2D>` transform **)**
  1005. Sets the global transformation for the region.
  1006. .. rst-class:: classref-item-separator
  1007. ----
  1008. .. _class_NavigationServer2D_method_region_set_travel_cost:
  1009. .. rst-class:: classref-method
  1010. void **region_set_travel_cost** **(** :ref:`RID<class_RID>` region, :ref:`float<class_float>` travel_cost **)**
  1011. Sets the ``travel_cost`` for this ``region``.
  1012. .. rst-class:: classref-item-separator
  1013. ----
  1014. .. _class_NavigationServer2D_method_region_set_use_edge_connections:
  1015. .. rst-class:: classref-method
  1016. void **region_set_use_edge_connections** **(** :ref:`RID<class_RID>` region, :ref:`bool<class_bool>` enabled **)**
  1017. 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.
  1018. .. rst-class:: classref-item-separator
  1019. ----
  1020. .. _class_NavigationServer2D_method_set_debug_enabled:
  1021. .. rst-class:: classref-method
  1022. void **set_debug_enabled** **(** :ref:`bool<class_bool>` enabled **)**
  1023. If ``true`` enables debug mode on the NavigationServer.
  1024. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1025. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1026. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1027. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  1028. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  1029. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  1030. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`