class_navigationpolygon.rst 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  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/NavigationPolygon.xml.
  6. .. _class_NavigationPolygon:
  7. NavigationPolygon
  8. =================
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A 2D navigation mesh that describes a traversable surface for pathfinding.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A navigation mesh can be created either by baking it with the help of the :ref:`NavigationServer2D<class_NavigationServer2D>`, or by adding vertices and convex polygon indices arrays manually.
  15. To bake a navigation mesh at least one outline needs to be added that defines the outer bounds of the baked area.
  16. .. tabs::
  17. .. code-tab:: gdscript
  18. var new_navigation_mesh = NavigationPolygon.new()
  19. var bounding_outline = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
  20. new_navigation_mesh.add_outline(bounding_outline)
  21. NavigationServer2D.bake_from_source_geometry_data(new_navigation_mesh, NavigationMeshSourceGeometryData2D.new());
  22. $NavigationRegion2D.navigation_polygon = new_navigation_mesh
  23. .. code-tab:: csharp
  24. var newNavigationMesh = new NavigationPolygon();
  25. var boundingOutline = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) };
  26. newNavigationMesh.AddOutline(boundingOutline);
  27. NavigationServer2D.BakeFromSourceGeometryData(newNavigationMesh, new NavigationMeshSourceGeometryData2D());
  28. GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh;
  29. Adding vertices and polygon indices manually.
  30. .. tabs::
  31. .. code-tab:: gdscript
  32. var new_navigation_mesh = NavigationPolygon.new()
  33. var new_vertices = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
  34. new_navigation_mesh.vertices = new_vertices
  35. var new_polygon_indices = PackedInt32Array([0, 1, 2, 3])
  36. new_navigation_mesh.add_polygon(new_polygon_indices)
  37. $NavigationRegion2D.navigation_polygon = new_navigation_mesh
  38. .. code-tab:: csharp
  39. var newNavigationMesh = new NavigationPolygon();
  40. var newVertices = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) };
  41. newNavigationMesh.Vertices = newVertices;
  42. var newPolygonIndices = new int[] { 0, 1, 2, 3 };
  43. newNavigationMesh.AddPolygon(newPolygonIndices);
  44. GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh;
  45. .. rst-class:: classref-introduction-group
  46. Tutorials
  47. ---------
  48. - `2D Navigation Demo <https://godotengine.org/asset-library/asset/117>`__
  49. - :doc:`Using NavigationMeshes <../tutorials/navigation/navigation_using_navigationmeshes>`
  50. .. rst-class:: classref-reftable-group
  51. Properties
  52. ----------
  53. .. table::
  54. :widths: auto
  55. +----------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  56. | :ref:`float<class_float>` | :ref:`agent_radius<class_NavigationPolygon_property_agent_radius>` | ``10.0`` |
  57. +----------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  58. | :ref:`float<class_float>` | :ref:`cell_size<class_NavigationPolygon_property_cell_size>` | ``1.0`` |
  59. +----------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  60. | :ref:`int<class_int>` | :ref:`parsed_collision_mask<class_NavigationPolygon_property_parsed_collision_mask>` | ``4294967295`` |
  61. +----------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  62. | :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` | :ref:`parsed_geometry_type<class_NavigationPolygon_property_parsed_geometry_type>` | ``2`` |
  63. +----------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  64. | :ref:`StringName<class_StringName>` | :ref:`source_geometry_group_name<class_NavigationPolygon_property_source_geometry_group_name>` | ``&"navigation_polygon_source_geometry_group"`` |
  65. +----------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  66. | :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` | :ref:`source_geometry_mode<class_NavigationPolygon_property_source_geometry_mode>` | ``0`` |
  67. +----------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  68. .. rst-class:: classref-reftable-group
  69. Methods
  70. -------
  71. .. table::
  72. :widths: auto
  73. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | void | :ref:`add_outline<class_NavigationPolygon_method_add_outline>` **(** :ref:`PackedVector2Array<class_PackedVector2Array>` outline **)** |
  75. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`add_outline_at_index<class_NavigationPolygon_method_add_outline_at_index>` **(** :ref:`PackedVector2Array<class_PackedVector2Array>` outline, :ref:`int<class_int>` index **)** |
  77. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | void | :ref:`add_polygon<class_NavigationPolygon_method_add_polygon>` **(** :ref:`PackedInt32Array<class_PackedInt32Array>` polygon **)** |
  79. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`clear<class_NavigationPolygon_method_clear>` **(** **)** |
  81. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`clear_outlines<class_NavigationPolygon_method_clear_outlines>` **(** **)** |
  83. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`clear_polygons<class_NavigationPolygon_method_clear_polygons>` **(** **)** |
  85. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`get_navigation_mesh<class_NavigationPolygon_method_get_navigation_mesh>` **(** **)** |
  87. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_outline<class_NavigationPolygon_method_get_outline>` **(** :ref:`int<class_int>` idx **)** |const| |
  89. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`int<class_int>` | :ref:`get_outline_count<class_NavigationPolygon_method_get_outline_count>` **(** **)** |const| |
  91. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`bool<class_bool>` | :ref:`get_parsed_collision_mask_value<class_NavigationPolygon_method_get_parsed_collision_mask_value>` **(** :ref:`int<class_int>` layer_number **)** |const| |
  93. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_polygon<class_NavigationPolygon_method_get_polygon>` **(** :ref:`int<class_int>` idx **)** |
  95. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`int<class_int>` | :ref:`get_polygon_count<class_NavigationPolygon_method_get_polygon_count>` **(** **)** |const| |
  97. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_vertices<class_NavigationPolygon_method_get_vertices>` **(** **)** |const| |
  99. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`make_polygons_from_outlines<class_NavigationPolygon_method_make_polygons_from_outlines>` **(** **)** |
  101. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | void | :ref:`remove_outline<class_NavigationPolygon_method_remove_outline>` **(** :ref:`int<class_int>` idx **)** |
  103. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | void | :ref:`set_outline<class_NavigationPolygon_method_set_outline>` **(** :ref:`int<class_int>` idx, :ref:`PackedVector2Array<class_PackedVector2Array>` outline **)** |
  105. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | void | :ref:`set_parsed_collision_mask_value<class_NavigationPolygon_method_set_parsed_collision_mask_value>` **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)** |
  107. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | void | :ref:`set_vertices<class_NavigationPolygon_method_set_vertices>` **(** :ref:`PackedVector2Array<class_PackedVector2Array>` vertices **)** |
  109. +-----------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. .. rst-class:: classref-section-separator
  111. ----
  112. .. rst-class:: classref-descriptions-group
  113. Enumerations
  114. ------------
  115. .. _enum_NavigationPolygon_ParsedGeometryType:
  116. .. rst-class:: classref-enumeration
  117. enum **ParsedGeometryType**:
  118. .. _class_NavigationPolygon_constant_PARSED_GEOMETRY_MESH_INSTANCES:
  119. .. rst-class:: classref-enumeration-constant
  120. :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_MESH_INSTANCES** = ``0``
  121. Parses mesh instances as obstruction geometry. This includes :ref:`Polygon2D<class_Polygon2D>`, :ref:`MeshInstance2D<class_MeshInstance2D>`, :ref:`MultiMeshInstance2D<class_MultiMeshInstance2D>`, and :ref:`TileMap<class_TileMap>` nodes.
  122. Meshes are only parsed when they use a 2D vertices surface format.
  123. .. _class_NavigationPolygon_constant_PARSED_GEOMETRY_STATIC_COLLIDERS:
  124. .. rst-class:: classref-enumeration-constant
  125. :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_STATIC_COLLIDERS** = ``1``
  126. Parses :ref:`StaticBody2D<class_StaticBody2D>` and :ref:`TileMap<class_TileMap>` colliders as obstruction geometry. The collider should be in any of the layers specified by :ref:`parsed_collision_mask<class_NavigationPolygon_property_parsed_collision_mask>`.
  127. .. _class_NavigationPolygon_constant_PARSED_GEOMETRY_BOTH:
  128. .. rst-class:: classref-enumeration-constant
  129. :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_BOTH** = ``2``
  130. Both :ref:`PARSED_GEOMETRY_MESH_INSTANCES<class_NavigationPolygon_constant_PARSED_GEOMETRY_MESH_INSTANCES>` and :ref:`PARSED_GEOMETRY_STATIC_COLLIDERS<class_NavigationPolygon_constant_PARSED_GEOMETRY_STATIC_COLLIDERS>`.
  131. .. _class_NavigationPolygon_constant_PARSED_GEOMETRY_MAX:
  132. .. rst-class:: classref-enumeration-constant
  133. :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_MAX** = ``3``
  134. Represents the size of the :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` enum.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _enum_NavigationPolygon_SourceGeometryMode:
  138. .. rst-class:: classref-enumeration
  139. enum **SourceGeometryMode**:
  140. .. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_ROOT_NODE_CHILDREN:
  141. .. rst-class:: classref-enumeration-constant
  142. :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_ROOT_NODE_CHILDREN** = ``0``
  143. Scans the child nodes of the root node recursively for geometry.
  144. .. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN:
  145. .. rst-class:: classref-enumeration-constant
  146. :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN** = ``1``
  147. Scans nodes in a group and their child nodes recursively for geometry. The group is specified by :ref:`source_geometry_group_name<class_NavigationPolygon_property_source_geometry_group_name>`.
  148. .. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_GROUPS_EXPLICIT:
  149. .. rst-class:: classref-enumeration-constant
  150. :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_GROUPS_EXPLICIT** = ``2``
  151. Uses nodes in a group for geometry. The group is specified by :ref:`source_geometry_group_name<class_NavigationPolygon_property_source_geometry_group_name>`.
  152. .. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_MAX:
  153. .. rst-class:: classref-enumeration-constant
  154. :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_MAX** = ``3``
  155. Represents the size of the :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` enum.
  156. .. rst-class:: classref-section-separator
  157. ----
  158. .. rst-class:: classref-descriptions-group
  159. Property Descriptions
  160. ---------------------
  161. .. _class_NavigationPolygon_property_agent_radius:
  162. .. rst-class:: classref-property
  163. :ref:`float<class_float>` **agent_radius** = ``10.0``
  164. .. rst-class:: classref-property-setget
  165. - void **set_agent_radius** **(** :ref:`float<class_float>` value **)**
  166. - :ref:`float<class_float>` **get_agent_radius** **(** **)**
  167. The distance to erode/shrink the walkable surface when baking the navigation mesh.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_NavigationPolygon_property_cell_size:
  171. .. rst-class:: classref-property
  172. :ref:`float<class_float>` **cell_size** = ``1.0``
  173. .. rst-class:: classref-property-setget
  174. - void **set_cell_size** **(** :ref:`float<class_float>` value **)**
  175. - :ref:`float<class_float>` **get_cell_size** **(** **)**
  176. The cell size used to rasterize the navigation mesh vertices. Must match with the cell size on the navigation map.
  177. .. rst-class:: classref-item-separator
  178. ----
  179. .. _class_NavigationPolygon_property_parsed_collision_mask:
  180. .. rst-class:: classref-property
  181. :ref:`int<class_int>` **parsed_collision_mask** = ``4294967295``
  182. .. rst-class:: classref-property-setget
  183. - void **set_parsed_collision_mask** **(** :ref:`int<class_int>` value **)**
  184. - :ref:`int<class_int>` **get_parsed_collision_mask** **(** **)**
  185. The physics layers to scan for static colliders.
  186. Only used when :ref:`parsed_geometry_type<class_NavigationPolygon_property_parsed_geometry_type>` is :ref:`PARSED_GEOMETRY_STATIC_COLLIDERS<class_NavigationPolygon_constant_PARSED_GEOMETRY_STATIC_COLLIDERS>` or :ref:`PARSED_GEOMETRY_BOTH<class_NavigationPolygon_constant_PARSED_GEOMETRY_BOTH>`.
  187. .. rst-class:: classref-item-separator
  188. ----
  189. .. _class_NavigationPolygon_property_parsed_geometry_type:
  190. .. rst-class:: classref-property
  191. :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **parsed_geometry_type** = ``2``
  192. .. rst-class:: classref-property-setget
  193. - void **set_parsed_geometry_type** **(** :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` value **)**
  194. - :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **get_parsed_geometry_type** **(** **)**
  195. Determines which type of nodes will be parsed as geometry. See :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` for possible values.
  196. .. rst-class:: classref-item-separator
  197. ----
  198. .. _class_NavigationPolygon_property_source_geometry_group_name:
  199. .. rst-class:: classref-property
  200. :ref:`StringName<class_StringName>` **source_geometry_group_name** = ``&"navigation_polygon_source_geometry_group"``
  201. .. rst-class:: classref-property-setget
  202. - void **set_source_geometry_group_name** **(** :ref:`StringName<class_StringName>` value **)**
  203. - :ref:`StringName<class_StringName>` **get_source_geometry_group_name** **(** **)**
  204. The group name of nodes that should be parsed for baking source geometry.
  205. Only used when :ref:`source_geometry_mode<class_NavigationPolygon_property_source_geometry_mode>` is :ref:`SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN<class_NavigationPolygon_constant_SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN>` or :ref:`SOURCE_GEOMETRY_GROUPS_EXPLICIT<class_NavigationPolygon_constant_SOURCE_GEOMETRY_GROUPS_EXPLICIT>`.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_NavigationPolygon_property_source_geometry_mode:
  209. .. rst-class:: classref-property
  210. :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **source_geometry_mode** = ``0``
  211. .. rst-class:: classref-property-setget
  212. - void **set_source_geometry_mode** **(** :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` value **)**
  213. - :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **get_source_geometry_mode** **(** **)**
  214. The source of the geometry used when baking. See :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` for possible values.
  215. .. rst-class:: classref-section-separator
  216. ----
  217. .. rst-class:: classref-descriptions-group
  218. Method Descriptions
  219. -------------------
  220. .. _class_NavigationPolygon_method_add_outline:
  221. .. rst-class:: classref-method
  222. void **add_outline** **(** :ref:`PackedVector2Array<class_PackedVector2Array>` outline **)**
  223. Appends a :ref:`PackedVector2Array<class_PackedVector2Array>` that contains the vertices of an outline to the internal array that contains all the outlines.
  224. .. rst-class:: classref-item-separator
  225. ----
  226. .. _class_NavigationPolygon_method_add_outline_at_index:
  227. .. rst-class:: classref-method
  228. void **add_outline_at_index** **(** :ref:`PackedVector2Array<class_PackedVector2Array>` outline, :ref:`int<class_int>` index **)**
  229. Adds a :ref:`PackedVector2Array<class_PackedVector2Array>` that contains the vertices of an outline to the internal array that contains all the outlines at a fixed position.
  230. .. rst-class:: classref-item-separator
  231. ----
  232. .. _class_NavigationPolygon_method_add_polygon:
  233. .. rst-class:: classref-method
  234. void **add_polygon** **(** :ref:`PackedInt32Array<class_PackedInt32Array>` polygon **)**
  235. Adds a polygon using the indices of the vertices you get when calling :ref:`get_vertices<class_NavigationPolygon_method_get_vertices>`.
  236. .. rst-class:: classref-item-separator
  237. ----
  238. .. _class_NavigationPolygon_method_clear:
  239. .. rst-class:: classref-method
  240. void **clear** **(** **)**
  241. Clears the internal arrays for vertices and polygon indices.
  242. .. rst-class:: classref-item-separator
  243. ----
  244. .. _class_NavigationPolygon_method_clear_outlines:
  245. .. rst-class:: classref-method
  246. void **clear_outlines** **(** **)**
  247. Clears the array of the outlines, but it doesn't clear the vertices and the polygons that were created by them.
  248. .. rst-class:: classref-item-separator
  249. ----
  250. .. _class_NavigationPolygon_method_clear_polygons:
  251. .. rst-class:: classref-method
  252. void **clear_polygons** **(** **)**
  253. Clears the array of polygons, but it doesn't clear the array of outlines and vertices.
  254. .. rst-class:: classref-item-separator
  255. ----
  256. .. _class_NavigationPolygon_method_get_navigation_mesh:
  257. .. rst-class:: classref-method
  258. :ref:`NavigationMesh<class_NavigationMesh>` **get_navigation_mesh** **(** **)**
  259. Returns the :ref:`NavigationMesh<class_NavigationMesh>` resulting from this navigation polygon. This navigation mesh can be used to update the navigation mesh of a region with the :ref:`NavigationServer3D.region_set_navigation_mesh<class_NavigationServer3D_method_region_set_navigation_mesh>` API directly (as 2D uses the 3D server behind the scene).
  260. .. rst-class:: classref-item-separator
  261. ----
  262. .. _class_NavigationPolygon_method_get_outline:
  263. .. rst-class:: classref-method
  264. :ref:`PackedVector2Array<class_PackedVector2Array>` **get_outline** **(** :ref:`int<class_int>` idx **)** |const|
  265. Returns a :ref:`PackedVector2Array<class_PackedVector2Array>` containing the vertices of an outline that was created in the editor or by script.
  266. .. rst-class:: classref-item-separator
  267. ----
  268. .. _class_NavigationPolygon_method_get_outline_count:
  269. .. rst-class:: classref-method
  270. :ref:`int<class_int>` **get_outline_count** **(** **)** |const|
  271. Returns the number of outlines that were created in the editor or by script.
  272. .. rst-class:: classref-item-separator
  273. ----
  274. .. _class_NavigationPolygon_method_get_parsed_collision_mask_value:
  275. .. rst-class:: classref-method
  276. :ref:`bool<class_bool>` **get_parsed_collision_mask_value** **(** :ref:`int<class_int>` layer_number **)** |const|
  277. Returns whether or not the specified layer of the :ref:`parsed_collision_mask<class_NavigationPolygon_property_parsed_collision_mask>` is enabled, given a ``layer_number`` between 1 and 32.
  278. .. rst-class:: classref-item-separator
  279. ----
  280. .. _class_NavigationPolygon_method_get_polygon:
  281. .. rst-class:: classref-method
  282. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_polygon** **(** :ref:`int<class_int>` idx **)**
  283. Returns a :ref:`PackedInt32Array<class_PackedInt32Array>` containing the indices of the vertices of a created polygon.
  284. .. rst-class:: classref-item-separator
  285. ----
  286. .. _class_NavigationPolygon_method_get_polygon_count:
  287. .. rst-class:: classref-method
  288. :ref:`int<class_int>` **get_polygon_count** **(** **)** |const|
  289. Returns the count of all polygons.
  290. .. rst-class:: classref-item-separator
  291. ----
  292. .. _class_NavigationPolygon_method_get_vertices:
  293. .. rst-class:: classref-method
  294. :ref:`PackedVector2Array<class_PackedVector2Array>` **get_vertices** **(** **)** |const|
  295. Returns a :ref:`PackedVector2Array<class_PackedVector2Array>` containing all the vertices being used to create the polygons.
  296. .. rst-class:: classref-item-separator
  297. ----
  298. .. _class_NavigationPolygon_method_make_polygons_from_outlines:
  299. .. rst-class:: classref-method
  300. void **make_polygons_from_outlines** **(** **)**
  301. Creates polygons from the outlines added in the editor or by script.
  302. \ *Deprecated.* This function is deprecated, and might be removed in a future release. Use :ref:`NavigationServer2D.parse_source_geometry_data<class_NavigationServer2D_method_parse_source_geometry_data>` and :ref:`NavigationServer2D.bake_from_source_geometry_data<class_NavigationServer2D_method_bake_from_source_geometry_data>` instead.
  303. .. rst-class:: classref-item-separator
  304. ----
  305. .. _class_NavigationPolygon_method_remove_outline:
  306. .. rst-class:: classref-method
  307. void **remove_outline** **(** :ref:`int<class_int>` idx **)**
  308. Removes an outline created in the editor or by script. You have to call :ref:`make_polygons_from_outlines<class_NavigationPolygon_method_make_polygons_from_outlines>` for the polygons to update.
  309. .. rst-class:: classref-item-separator
  310. ----
  311. .. _class_NavigationPolygon_method_set_outline:
  312. .. rst-class:: classref-method
  313. void **set_outline** **(** :ref:`int<class_int>` idx, :ref:`PackedVector2Array<class_PackedVector2Array>` outline **)**
  314. Changes an outline created in the editor or by script. You have to call :ref:`make_polygons_from_outlines<class_NavigationPolygon_method_make_polygons_from_outlines>` for the polygons to update.
  315. .. rst-class:: classref-item-separator
  316. ----
  317. .. _class_NavigationPolygon_method_set_parsed_collision_mask_value:
  318. .. rst-class:: classref-method
  319. void **set_parsed_collision_mask_value** **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)**
  320. Based on ``value``, enables or disables the specified layer in the :ref:`parsed_collision_mask<class_NavigationPolygon_property_parsed_collision_mask>`, given a ``layer_number`` between 1 and 32.
  321. .. rst-class:: classref-item-separator
  322. ----
  323. .. _class_NavigationPolygon_method_set_vertices:
  324. .. rst-class:: classref-method
  325. void **set_vertices** **(** :ref:`PackedVector2Array<class_PackedVector2Array>` vertices **)**
  326. Sets the vertices that can be then indexed to create polygons with the :ref:`add_polygon<class_NavigationPolygon_method_add_polygon>` method.
  327. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  328. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  329. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  330. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  331. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  332. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  333. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`