class_navigationpolygon.rst 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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. **Experimental:** This class may be changed or removed in future versions.
  10. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  11. A 2D navigation mesh that describes a traversable surface for pathfinding.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. 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.
  16. To bake a navigation mesh at least one outline needs to be added that defines the outer bounds of the baked area.
  17. .. tabs::
  18. .. code-tab:: gdscript
  19. var new_navigation_mesh = NavigationPolygon.new()
  20. var bounding_outline = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
  21. new_navigation_mesh.add_outline(bounding_outline)
  22. NavigationServer2D.bake_from_source_geometry_data(new_navigation_mesh, NavigationMeshSourceGeometryData2D.new());
  23. $NavigationRegion2D.navigation_polygon = new_navigation_mesh
  24. .. code-tab:: csharp
  25. var newNavigationMesh = new NavigationPolygon();
  26. var boundingOutline = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) };
  27. newNavigationMesh.AddOutline(boundingOutline);
  28. NavigationServer2D.BakeFromSourceGeometryData(newNavigationMesh, new NavigationMeshSourceGeometryData2D());
  29. GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh;
  30. Adding vertices and polygon indices manually.
  31. .. tabs::
  32. .. code-tab:: gdscript
  33. var new_navigation_mesh = NavigationPolygon.new()
  34. var new_vertices = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
  35. new_navigation_mesh.vertices = new_vertices
  36. var new_polygon_indices = PackedInt32Array([0, 1, 2, 3])
  37. new_navigation_mesh.add_polygon(new_polygon_indices)
  38. $NavigationRegion2D.navigation_polygon = new_navigation_mesh
  39. .. code-tab:: csharp
  40. var newNavigationMesh = new NavigationPolygon();
  41. var newVertices = new Vector2[] { new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0) };
  42. newNavigationMesh.Vertices = newVertices;
  43. var newPolygonIndices = new int[] { 0, 1, 2, 3 };
  44. newNavigationMesh.AddPolygon(newPolygonIndices);
  45. GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh;
  46. .. rst-class:: classref-introduction-group
  47. Tutorials
  48. ---------
  49. - :doc:`Using NavigationMeshes <../tutorials/navigation/navigation_using_navigationmeshes>`
  50. - `Navigation Polygon 2D Demo <https://godotengine.org/asset-library/asset/2722>`__
  51. .. rst-class:: classref-reftable-group
  52. Properties
  53. ----------
  54. .. table::
  55. :widths: auto
  56. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  57. | :ref:`float<class_float>` | :ref:`agent_radius<class_NavigationPolygon_property_agent_radius>` | ``10.0`` |
  58. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  59. | :ref:`Rect2<class_Rect2>` | :ref:`baking_rect<class_NavigationPolygon_property_baking_rect>` | ``Rect2(0, 0, 0, 0)`` |
  60. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  61. | :ref:`Vector2<class_Vector2>` | :ref:`baking_rect_offset<class_NavigationPolygon_property_baking_rect_offset>` | ``Vector2(0, 0)`` |
  62. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  63. | :ref:`float<class_float>` | :ref:`border_size<class_NavigationPolygon_property_border_size>` | ``0.0`` |
  64. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  65. | :ref:`float<class_float>` | :ref:`cell_size<class_NavigationPolygon_property_cell_size>` | ``1.0`` |
  66. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  67. | :ref:`int<class_int>` | :ref:`parsed_collision_mask<class_NavigationPolygon_property_parsed_collision_mask>` | ``4294967295`` |
  68. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  69. | :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` | :ref:`parsed_geometry_type<class_NavigationPolygon_property_parsed_geometry_type>` | ``2`` |
  70. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  71. | :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` | :ref:`sample_partition_type<class_NavigationPolygon_property_sample_partition_type>` | ``0`` |
  72. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  73. | :ref:`StringName<class_StringName>` | :ref:`source_geometry_group_name<class_NavigationPolygon_property_source_geometry_group_name>` | ``&"navigation_polygon_source_geometry_group"`` |
  74. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  75. | :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` | :ref:`source_geometry_mode<class_NavigationPolygon_property_source_geometry_mode>` | ``0`` |
  76. +------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
  77. .. rst-class:: classref-reftable-group
  78. Methods
  79. -------
  80. .. table::
  81. :widths: auto
  82. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | |void| | :ref:`add_outline<class_NavigationPolygon_method_add_outline>`\ (\ outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) |
  84. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | |void| | :ref:`add_outline_at_index<class_NavigationPolygon_method_add_outline_at_index>`\ (\ outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`, index\: :ref:`int<class_int>`\ ) |
  86. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | |void| | :ref:`add_polygon<class_NavigationPolygon_method_add_polygon>`\ (\ polygon\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ ) |
  88. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | |void| | :ref:`clear<class_NavigationPolygon_method_clear>`\ (\ ) |
  90. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | |void| | :ref:`clear_outlines<class_NavigationPolygon_method_clear_outlines>`\ (\ ) |
  92. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | |void| | :ref:`clear_polygons<class_NavigationPolygon_method_clear_polygons>`\ (\ ) |
  94. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`get_navigation_mesh<class_NavigationPolygon_method_get_navigation_mesh>`\ (\ ) |
  96. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_outline<class_NavigationPolygon_method_get_outline>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  98. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`int<class_int>` | :ref:`get_outline_count<class_NavigationPolygon_method_get_outline_count>`\ (\ ) |const| |
  100. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`bool<class_bool>` | :ref:`get_parsed_collision_mask_value<class_NavigationPolygon_method_get_parsed_collision_mask_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
  102. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_polygon<class_NavigationPolygon_method_get_polygon>`\ (\ idx\: :ref:`int<class_int>`\ ) |
  104. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`int<class_int>` | :ref:`get_polygon_count<class_NavigationPolygon_method_get_polygon_count>`\ (\ ) |const| |
  106. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_vertices<class_NavigationPolygon_method_get_vertices>`\ (\ ) |const| |
  108. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | |void| | :ref:`make_polygons_from_outlines<class_NavigationPolygon_method_make_polygons_from_outlines>`\ (\ ) |
  110. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | |void| | :ref:`remove_outline<class_NavigationPolygon_method_remove_outline>`\ (\ idx\: :ref:`int<class_int>`\ ) |
  112. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | |void| | :ref:`set_outline<class_NavigationPolygon_method_set_outline>`\ (\ idx\: :ref:`int<class_int>`, outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) |
  114. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | |void| | :ref:`set_parsed_collision_mask_value<class_NavigationPolygon_method_set_parsed_collision_mask_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  116. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | |void| | :ref:`set_vertices<class_NavigationPolygon_method_set_vertices>`\ (\ vertices\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) |
  118. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. .. rst-class:: classref-section-separator
  120. ----
  121. .. rst-class:: classref-descriptions-group
  122. Enumerations
  123. ------------
  124. .. _enum_NavigationPolygon_SamplePartitionType:
  125. .. rst-class:: classref-enumeration
  126. enum **SamplePartitionType**: :ref:`🔗<enum_NavigationPolygon_SamplePartitionType>`
  127. .. _class_NavigationPolygon_constant_SAMPLE_PARTITION_CONVEX_PARTITION:
  128. .. rst-class:: classref-enumeration-constant
  129. :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` **SAMPLE_PARTITION_CONVEX_PARTITION** = ``0``
  130. Convex partitioning that yields navigation mesh with convex polygons.
  131. .. _class_NavigationPolygon_constant_SAMPLE_PARTITION_TRIANGULATE:
  132. .. rst-class:: classref-enumeration-constant
  133. :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` **SAMPLE_PARTITION_TRIANGULATE** = ``1``
  134. Triangulation partitioning that yields navigation mesh with triangle polygons.
  135. .. _class_NavigationPolygon_constant_SAMPLE_PARTITION_MAX:
  136. .. rst-class:: classref-enumeration-constant
  137. :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` **SAMPLE_PARTITION_MAX** = ``2``
  138. Represents the size of the :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` enum.
  139. .. rst-class:: classref-item-separator
  140. ----
  141. .. _enum_NavigationPolygon_ParsedGeometryType:
  142. .. rst-class:: classref-enumeration
  143. enum **ParsedGeometryType**: :ref:`🔗<enum_NavigationPolygon_ParsedGeometryType>`
  144. .. _class_NavigationPolygon_constant_PARSED_GEOMETRY_MESH_INSTANCES:
  145. .. rst-class:: classref-enumeration-constant
  146. :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_MESH_INSTANCES** = ``0``
  147. 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.
  148. Meshes are only parsed when they use a 2D vertices surface format.
  149. .. _class_NavigationPolygon_constant_PARSED_GEOMETRY_STATIC_COLLIDERS:
  150. .. rst-class:: classref-enumeration-constant
  151. :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_STATIC_COLLIDERS** = ``1``
  152. 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>`.
  153. .. _class_NavigationPolygon_constant_PARSED_GEOMETRY_BOTH:
  154. .. rst-class:: classref-enumeration-constant
  155. :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_BOTH** = ``2``
  156. 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>`.
  157. .. _class_NavigationPolygon_constant_PARSED_GEOMETRY_MAX:
  158. .. rst-class:: classref-enumeration-constant
  159. :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_MAX** = ``3``
  160. Represents the size of the :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` enum.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _enum_NavigationPolygon_SourceGeometryMode:
  164. .. rst-class:: classref-enumeration
  165. enum **SourceGeometryMode**: :ref:`🔗<enum_NavigationPolygon_SourceGeometryMode>`
  166. .. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_ROOT_NODE_CHILDREN:
  167. .. rst-class:: classref-enumeration-constant
  168. :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_ROOT_NODE_CHILDREN** = ``0``
  169. Scans the child nodes of the root node recursively for geometry.
  170. .. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN:
  171. .. rst-class:: classref-enumeration-constant
  172. :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN** = ``1``
  173. 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>`.
  174. .. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_GROUPS_EXPLICIT:
  175. .. rst-class:: classref-enumeration-constant
  176. :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_GROUPS_EXPLICIT** = ``2``
  177. Uses nodes in a group for geometry. The group is specified by :ref:`source_geometry_group_name<class_NavigationPolygon_property_source_geometry_group_name>`.
  178. .. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_MAX:
  179. .. rst-class:: classref-enumeration-constant
  180. :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_MAX** = ``3``
  181. Represents the size of the :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` enum.
  182. .. rst-class:: classref-section-separator
  183. ----
  184. .. rst-class:: classref-descriptions-group
  185. Property Descriptions
  186. ---------------------
  187. .. _class_NavigationPolygon_property_agent_radius:
  188. .. rst-class:: classref-property
  189. :ref:`float<class_float>` **agent_radius** = ``10.0`` :ref:`🔗<class_NavigationPolygon_property_agent_radius>`
  190. .. rst-class:: classref-property-setget
  191. - |void| **set_agent_radius**\ (\ value\: :ref:`float<class_float>`\ )
  192. - :ref:`float<class_float>` **get_agent_radius**\ (\ )
  193. The distance to erode/shrink the walkable surface when baking the navigation mesh.
  194. .. rst-class:: classref-item-separator
  195. ----
  196. .. _class_NavigationPolygon_property_baking_rect:
  197. .. rst-class:: classref-property
  198. :ref:`Rect2<class_Rect2>` **baking_rect** = ``Rect2(0, 0, 0, 0)`` :ref:`🔗<class_NavigationPolygon_property_baking_rect>`
  199. .. rst-class:: classref-property-setget
  200. - |void| **set_baking_rect**\ (\ value\: :ref:`Rect2<class_Rect2>`\ )
  201. - :ref:`Rect2<class_Rect2>` **get_baking_rect**\ (\ )
  202. If the baking :ref:`Rect2<class_Rect2>` has an area the navigation mesh baking will be restricted to its enclosing area.
  203. .. rst-class:: classref-item-separator
  204. ----
  205. .. _class_NavigationPolygon_property_baking_rect_offset:
  206. .. rst-class:: classref-property
  207. :ref:`Vector2<class_Vector2>` **baking_rect_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_NavigationPolygon_property_baking_rect_offset>`
  208. .. rst-class:: classref-property-setget
  209. - |void| **set_baking_rect_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
  210. - :ref:`Vector2<class_Vector2>` **get_baking_rect_offset**\ (\ )
  211. The position offset applied to the :ref:`baking_rect<class_NavigationPolygon_property_baking_rect>` :ref:`Rect2<class_Rect2>`.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_NavigationPolygon_property_border_size:
  215. .. rst-class:: classref-property
  216. :ref:`float<class_float>` **border_size** = ``0.0`` :ref:`🔗<class_NavigationPolygon_property_border_size>`
  217. .. rst-class:: classref-property-setget
  218. - |void| **set_border_size**\ (\ value\: :ref:`float<class_float>`\ )
  219. - :ref:`float<class_float>` **get_border_size**\ (\ )
  220. The size of the non-navigable border around the bake bounding area defined by the :ref:`baking_rect<class_NavigationPolygon_property_baking_rect>` :ref:`Rect2<class_Rect2>`.
  221. In conjunction with the :ref:`baking_rect<class_NavigationPolygon_property_baking_rect>` the border size can be used to bake tile aligned navigation meshes without the tile edges being shrunk by :ref:`agent_radius<class_NavigationPolygon_property_agent_radius>`.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_NavigationPolygon_property_cell_size:
  225. .. rst-class:: classref-property
  226. :ref:`float<class_float>` **cell_size** = ``1.0`` :ref:`🔗<class_NavigationPolygon_property_cell_size>`
  227. .. rst-class:: classref-property-setget
  228. - |void| **set_cell_size**\ (\ value\: :ref:`float<class_float>`\ )
  229. - :ref:`float<class_float>` **get_cell_size**\ (\ )
  230. The cell size used to rasterize the navigation mesh vertices. Must match with the cell size on the navigation map.
  231. .. rst-class:: classref-item-separator
  232. ----
  233. .. _class_NavigationPolygon_property_parsed_collision_mask:
  234. .. rst-class:: classref-property
  235. :ref:`int<class_int>` **parsed_collision_mask** = ``4294967295`` :ref:`🔗<class_NavigationPolygon_property_parsed_collision_mask>`
  236. .. rst-class:: classref-property-setget
  237. - |void| **set_parsed_collision_mask**\ (\ value\: :ref:`int<class_int>`\ )
  238. - :ref:`int<class_int>` **get_parsed_collision_mask**\ (\ )
  239. The physics layers to scan for static colliders.
  240. 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>`.
  241. .. rst-class:: classref-item-separator
  242. ----
  243. .. _class_NavigationPolygon_property_parsed_geometry_type:
  244. .. rst-class:: classref-property
  245. :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **parsed_geometry_type** = ``2`` :ref:`🔗<class_NavigationPolygon_property_parsed_geometry_type>`
  246. .. rst-class:: classref-property-setget
  247. - |void| **set_parsed_geometry_type**\ (\ value\: :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>`\ )
  248. - :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **get_parsed_geometry_type**\ (\ )
  249. Determines which type of nodes will be parsed as geometry. See :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` for possible values.
  250. .. rst-class:: classref-item-separator
  251. ----
  252. .. _class_NavigationPolygon_property_sample_partition_type:
  253. .. rst-class:: classref-property
  254. :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` **sample_partition_type** = ``0`` :ref:`🔗<class_NavigationPolygon_property_sample_partition_type>`
  255. .. rst-class:: classref-property-setget
  256. - |void| **set_sample_partition_type**\ (\ value\: :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>`\ )
  257. - :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` **get_sample_partition_type**\ (\ )
  258. Partitioning algorithm for creating the navigation mesh polys. See :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` for possible values.
  259. .. rst-class:: classref-item-separator
  260. ----
  261. .. _class_NavigationPolygon_property_source_geometry_group_name:
  262. .. rst-class:: classref-property
  263. :ref:`StringName<class_StringName>` **source_geometry_group_name** = ``&"navigation_polygon_source_geometry_group"`` :ref:`🔗<class_NavigationPolygon_property_source_geometry_group_name>`
  264. .. rst-class:: classref-property-setget
  265. - |void| **set_source_geometry_group_name**\ (\ value\: :ref:`StringName<class_StringName>`\ )
  266. - :ref:`StringName<class_StringName>` **get_source_geometry_group_name**\ (\ )
  267. The group name of nodes that should be parsed for baking source geometry.
  268. 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>`.
  269. .. rst-class:: classref-item-separator
  270. ----
  271. .. _class_NavigationPolygon_property_source_geometry_mode:
  272. .. rst-class:: classref-property
  273. :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **source_geometry_mode** = ``0`` :ref:`🔗<class_NavigationPolygon_property_source_geometry_mode>`
  274. .. rst-class:: classref-property-setget
  275. - |void| **set_source_geometry_mode**\ (\ value\: :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>`\ )
  276. - :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **get_source_geometry_mode**\ (\ )
  277. The source of the geometry used when baking. See :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` for possible values.
  278. .. rst-class:: classref-section-separator
  279. ----
  280. .. rst-class:: classref-descriptions-group
  281. Method Descriptions
  282. -------------------
  283. .. _class_NavigationPolygon_method_add_outline:
  284. .. rst-class:: classref-method
  285. |void| **add_outline**\ (\ outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) :ref:`🔗<class_NavigationPolygon_method_add_outline>`
  286. Appends a :ref:`PackedVector2Array<class_PackedVector2Array>` that contains the vertices of an outline to the internal array that contains all the outlines.
  287. .. rst-class:: classref-item-separator
  288. ----
  289. .. _class_NavigationPolygon_method_add_outline_at_index:
  290. .. rst-class:: classref-method
  291. |void| **add_outline_at_index**\ (\ outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`, index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_NavigationPolygon_method_add_outline_at_index>`
  292. 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.
  293. .. rst-class:: classref-item-separator
  294. ----
  295. .. _class_NavigationPolygon_method_add_polygon:
  296. .. rst-class:: classref-method
  297. |void| **add_polygon**\ (\ polygon\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ ) :ref:`🔗<class_NavigationPolygon_method_add_polygon>`
  298. Adds a polygon using the indices of the vertices you get when calling :ref:`get_vertices<class_NavigationPolygon_method_get_vertices>`.
  299. .. rst-class:: classref-item-separator
  300. ----
  301. .. _class_NavigationPolygon_method_clear:
  302. .. rst-class:: classref-method
  303. |void| **clear**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_clear>`
  304. Clears the internal arrays for vertices and polygon indices.
  305. .. rst-class:: classref-item-separator
  306. ----
  307. .. _class_NavigationPolygon_method_clear_outlines:
  308. .. rst-class:: classref-method
  309. |void| **clear_outlines**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_clear_outlines>`
  310. Clears the array of the outlines, but it doesn't clear the vertices and the polygons that were created by them.
  311. .. rst-class:: classref-item-separator
  312. ----
  313. .. _class_NavigationPolygon_method_clear_polygons:
  314. .. rst-class:: classref-method
  315. |void| **clear_polygons**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_clear_polygons>`
  316. Clears the array of polygons, but it doesn't clear the array of outlines and vertices.
  317. .. rst-class:: classref-item-separator
  318. ----
  319. .. _class_NavigationPolygon_method_get_navigation_mesh:
  320. .. rst-class:: classref-method
  321. :ref:`NavigationMesh<class_NavigationMesh>` **get_navigation_mesh**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_get_navigation_mesh>`
  322. 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).
  323. .. rst-class:: classref-item-separator
  324. ----
  325. .. _class_NavigationPolygon_method_get_outline:
  326. .. rst-class:: classref-method
  327. :ref:`PackedVector2Array<class_PackedVector2Array>` **get_outline**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationPolygon_method_get_outline>`
  328. Returns a :ref:`PackedVector2Array<class_PackedVector2Array>` containing the vertices of an outline that was created in the editor or by script.
  329. .. rst-class:: classref-item-separator
  330. ----
  331. .. _class_NavigationPolygon_method_get_outline_count:
  332. .. rst-class:: classref-method
  333. :ref:`int<class_int>` **get_outline_count**\ (\ ) |const| :ref:`🔗<class_NavigationPolygon_method_get_outline_count>`
  334. Returns the number of outlines that were created in the editor or by script.
  335. .. rst-class:: classref-item-separator
  336. ----
  337. .. _class_NavigationPolygon_method_get_parsed_collision_mask_value:
  338. .. rst-class:: classref-method
  339. :ref:`bool<class_bool>` **get_parsed_collision_mask_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationPolygon_method_get_parsed_collision_mask_value>`
  340. 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.
  341. .. rst-class:: classref-item-separator
  342. ----
  343. .. _class_NavigationPolygon_method_get_polygon:
  344. .. rst-class:: classref-method
  345. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_polygon**\ (\ idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_NavigationPolygon_method_get_polygon>`
  346. Returns a :ref:`PackedInt32Array<class_PackedInt32Array>` containing the indices of the vertices of a created polygon.
  347. .. rst-class:: classref-item-separator
  348. ----
  349. .. _class_NavigationPolygon_method_get_polygon_count:
  350. .. rst-class:: classref-method
  351. :ref:`int<class_int>` **get_polygon_count**\ (\ ) |const| :ref:`🔗<class_NavigationPolygon_method_get_polygon_count>`
  352. Returns the count of all polygons.
  353. .. rst-class:: classref-item-separator
  354. ----
  355. .. _class_NavigationPolygon_method_get_vertices:
  356. .. rst-class:: classref-method
  357. :ref:`PackedVector2Array<class_PackedVector2Array>` **get_vertices**\ (\ ) |const| :ref:`🔗<class_NavigationPolygon_method_get_vertices>`
  358. Returns a :ref:`PackedVector2Array<class_PackedVector2Array>` containing all the vertices being used to create the polygons.
  359. .. rst-class:: classref-item-separator
  360. ----
  361. .. _class_NavigationPolygon_method_make_polygons_from_outlines:
  362. .. rst-class:: classref-method
  363. |void| **make_polygons_from_outlines**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_make_polygons_from_outlines>`
  364. **Deprecated:** 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.
  365. Creates polygons from the outlines added in the editor or by script.
  366. .. rst-class:: classref-item-separator
  367. ----
  368. .. _class_NavigationPolygon_method_remove_outline:
  369. .. rst-class:: classref-method
  370. |void| **remove_outline**\ (\ idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_NavigationPolygon_method_remove_outline>`
  371. 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.
  372. .. rst-class:: classref-item-separator
  373. ----
  374. .. _class_NavigationPolygon_method_set_outline:
  375. .. rst-class:: classref-method
  376. |void| **set_outline**\ (\ idx\: :ref:`int<class_int>`, outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) :ref:`🔗<class_NavigationPolygon_method_set_outline>`
  377. 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.
  378. .. rst-class:: classref-item-separator
  379. ----
  380. .. _class_NavigationPolygon_method_set_parsed_collision_mask_value:
  381. .. rst-class:: classref-method
  382. |void| **set_parsed_collision_mask_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationPolygon_method_set_parsed_collision_mask_value>`
  383. 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.
  384. .. rst-class:: classref-item-separator
  385. ----
  386. .. _class_NavigationPolygon_method_set_vertices:
  387. .. rst-class:: classref-method
  388. |void| **set_vertices**\ (\ vertices\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) :ref:`🔗<class_NavigationPolygon_method_set_vertices>`
  389. Sets the vertices that can be then indexed to create polygons with the :ref:`add_polygon<class_NavigationPolygon_method_add_polygon>` method.
  390. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  391. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  392. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  393. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  394. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  395. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  396. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  397. .. |void| replace:: :abbr:`void (No return value.)`