mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
694 lines
37 KiB
ReStructuredText
694 lines
37 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_NavigationPolygon:
|
||
|
||
NavigationPolygon
|
||
=================
|
||
|
||
**Expérimental :** This class may be changed or removed in future versions.
|
||
|
||
**Hérite de :** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
||
|
||
Un maillage de navigation 2D qui décrit une surface traversable pour la recherche de chemin.
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Description
|
||
-----------
|
||
|
||
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.
|
||
|
||
To bake a navigation mesh at least one outline needs to be added that defines the outer bounds of the baked area.
|
||
|
||
|
||
.. tabs::
|
||
|
||
.. code-tab:: gdscript
|
||
|
||
var new_navigation_mesh = NavigationPolygon.new()
|
||
var bounding_outline = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
|
||
new_navigation_mesh.add_outline(bounding_outline)
|
||
NavigationServer2D.bake_from_source_geometry_data(new_navigation_mesh, NavigationMeshSourceGeometryData2D.new());
|
||
$NavigationRegion2D.navigation_polygon = new_navigation_mesh
|
||
|
||
.. code-tab:: csharp
|
||
|
||
var newNavigationMesh = new NavigationPolygon();
|
||
Vector2[] boundingOutline = [new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0)];
|
||
newNavigationMesh.AddOutline(boundingOutline);
|
||
NavigationServer2D.BakeFromSourceGeometryData(newNavigationMesh, new NavigationMeshSourceGeometryData2D());
|
||
GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh;
|
||
|
||
|
||
|
||
Adding vertices and polygon indices manually.
|
||
|
||
|
||
.. tabs::
|
||
|
||
.. code-tab:: gdscript
|
||
|
||
var new_navigation_mesh = NavigationPolygon.new()
|
||
var new_vertices = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
|
||
new_navigation_mesh.vertices = new_vertices
|
||
var new_polygon_indices = PackedInt32Array([0, 1, 2, 3])
|
||
new_navigation_mesh.add_polygon(new_polygon_indices)
|
||
$NavigationRegion2D.navigation_polygon = new_navigation_mesh
|
||
|
||
.. code-tab:: csharp
|
||
|
||
var newNavigationMesh = new NavigationPolygon();
|
||
Vector2[] newVertices = [new Vector2(0, 0), new Vector2(0, 50), new Vector2(50, 50), new Vector2(50, 0)];
|
||
newNavigationMesh.Vertices = newVertices;
|
||
int[] newPolygonIndices = [0, 1, 2, 3];
|
||
newNavigationMesh.AddPolygon(newPolygonIndices);
|
||
GetNode<NavigationRegion2D>("NavigationRegion2D").NavigationPolygon = newNavigationMesh;
|
||
|
||
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Tutoriels
|
||
------------------
|
||
|
||
- :doc:`Utiliser les NavigationMesh <../tutorials/navigation/navigation_using_navigationmeshes>`
|
||
|
||
- `Démo de polygone de navigation 2D <https://godotengine.org/asset-library/asset/2722>`__
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Propriétés
|
||
--------------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
| :ref:`float<class_float>` | :ref:`agent_radius<class_NavigationPolygon_property_agent_radius>` | ``10.0`` |
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
| :ref:`Rect2<class_Rect2>` | :ref:`baking_rect<class_NavigationPolygon_property_baking_rect>` | ``Rect2(0, 0, 0, 0)`` |
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
| :ref:`Vector2<class_Vector2>` | :ref:`baking_rect_offset<class_NavigationPolygon_property_baking_rect_offset>` | ``Vector2(0, 0)`` |
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
| :ref:`float<class_float>` | :ref:`border_size<class_NavigationPolygon_property_border_size>` | ``0.0`` |
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
| :ref:`float<class_float>` | :ref:`cell_size<class_NavigationPolygon_property_cell_size>` | ``1.0`` |
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`parsed_collision_mask<class_NavigationPolygon_property_parsed_collision_mask>` | ``4294967295`` |
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
| :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` | :ref:`parsed_geometry_type<class_NavigationPolygon_property_parsed_geometry_type>` | ``2`` |
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
| :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` | :ref:`sample_partition_type<class_NavigationPolygon_property_sample_partition_type>` | ``0`` |
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
| :ref:`StringName<class_StringName>` | :ref:`source_geometry_group_name<class_NavigationPolygon_property_source_geometry_group_name>` | ``&"navigation_polygon_source_geometry_group"`` |
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
| :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` | :ref:`source_geometry_mode<class_NavigationPolygon_property_source_geometry_mode>` | ``0`` |
|
||
+------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------------------------------------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Méthodes
|
||
----------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`add_outline<class_NavigationPolygon_method_add_outline>`\ (\ outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`add_outline_at_index<class_NavigationPolygon_method_add_outline_at_index>`\ (\ outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`, index\: :ref:`int<class_int>`\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`add_polygon<class_NavigationPolygon_method_add_polygon>`\ (\ polygon\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`clear<class_NavigationPolygon_method_clear>`\ (\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`clear_outlines<class_NavigationPolygon_method_clear_outlines>`\ (\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`clear_polygons<class_NavigationPolygon_method_clear_polygons>`\ (\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`get_navigation_mesh<class_NavigationPolygon_method_get_navigation_mesh>`\ (\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_outline<class_NavigationPolygon_method_get_outline>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`get_outline_count<class_NavigationPolygon_method_get_outline_count>`\ (\ ) |const| |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :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| |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_polygon<class_NavigationPolygon_method_get_polygon>`\ (\ idx\: :ref:`int<class_int>`\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`get_polygon_count<class_NavigationPolygon_method_get_polygon_count>`\ (\ ) |const| |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_vertices<class_NavigationPolygon_method_get_vertices>`\ (\ ) |const| |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`make_polygons_from_outlines<class_NavigationPolygon_method_make_polygons_from_outlines>`\ (\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`remove_outline<class_NavigationPolygon_method_remove_outline>`\ (\ idx\: :ref:`int<class_int>`\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_outline<class_NavigationPolygon_method_set_outline>`\ (\ idx\: :ref:`int<class_int>`, outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |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>`\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_vertices<class_NavigationPolygon_method_set_vertices>`\ (\ vertices\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) |
|
||
+-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Énumérations
|
||
------------------------
|
||
|
||
.. _enum_NavigationPolygon_SamplePartitionType:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **SamplePartitionType**: :ref:`🔗<enum_NavigationPolygon_SamplePartitionType>`
|
||
|
||
.. _class_NavigationPolygon_constant_SAMPLE_PARTITION_CONVEX_PARTITION:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` **SAMPLE_PARTITION_CONVEX_PARTITION** = ``0``
|
||
|
||
Convex partitioning that results in a navigation mesh with convex polygons.
|
||
|
||
.. _class_NavigationPolygon_constant_SAMPLE_PARTITION_TRIANGULATE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` **SAMPLE_PARTITION_TRIANGULATE** = ``1``
|
||
|
||
Triangulation partitioning that results in a navigation mesh with triangle polygons.
|
||
|
||
.. _class_NavigationPolygon_constant_SAMPLE_PARTITION_MAX:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` **SAMPLE_PARTITION_MAX** = ``2``
|
||
|
||
Représente la taille de l'énumération :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_NavigationPolygon_ParsedGeometryType:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **ParsedGeometryType**: :ref:`🔗<enum_NavigationPolygon_ParsedGeometryType>`
|
||
|
||
.. _class_NavigationPolygon_constant_PARSED_GEOMETRY_MESH_INSTANCES:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_MESH_INSTANCES** = ``0``
|
||
|
||
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.
|
||
|
||
Meshes are only parsed when they use a 2D vertices surface format.
|
||
|
||
.. _class_NavigationPolygon_constant_PARSED_GEOMETRY_STATIC_COLLIDERS:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_STATIC_COLLIDERS** = ``1``
|
||
|
||
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>`.
|
||
|
||
.. _class_NavigationPolygon_constant_PARSED_GEOMETRY_BOTH:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_BOTH** = ``2``
|
||
|
||
À la fois :ref:`PARSED_GEOMETRY_MESH_INSTANCES<class_NavigationPolygon_constant_PARSED_GEOMETRY_MESH_INSTANCES>` et :ref:`PARSED_GEOMETRY_STATIC_COLLIDERS<class_NavigationPolygon_constant_PARSED_GEOMETRY_STATIC_COLLIDERS>`.
|
||
|
||
.. _class_NavigationPolygon_constant_PARSED_GEOMETRY_MAX:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_MAX** = ``3``
|
||
|
||
Représente la taille de l’enum :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_NavigationPolygon_SourceGeometryMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **SourceGeometryMode**: :ref:`🔗<enum_NavigationPolygon_SourceGeometryMode>`
|
||
|
||
.. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_ROOT_NODE_CHILDREN:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_ROOT_NODE_CHILDREN** = ``0``
|
||
|
||
Scans the child nodes of the root node recursively for geometry.
|
||
|
||
.. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN** = ``1``
|
||
|
||
Scanne les nœuds dans un groupe et leurs nœuds enfants récursivement pour de la géométrie. Le groupe est spécifié par :ref:`source_geometry_group_name<class_NavigationPolygon_property_source_geometry_group_name>`.
|
||
|
||
.. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_GROUPS_EXPLICIT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_GROUPS_EXPLICIT** = ``2``
|
||
|
||
Utilise des nœuds dans un groupe pour la géométrie. Le groupe est spécifié par :ref:`source_geometry_group_name<class_NavigationPolygon_property_source_geometry_group_name>`.
|
||
|
||
.. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_MAX:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_MAX** = ``3``
|
||
|
||
Représente la taille de l'énumération :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>`.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Descriptions des propriétés
|
||
------------------------------------------------------
|
||
|
||
.. _class_NavigationPolygon_property_agent_radius:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **agent_radius** = ``10.0`` :ref:`🔗<class_NavigationPolygon_property_agent_radius>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_agent_radius**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_agent_radius**\ (\ )
|
||
|
||
The distance to erode/shrink the walkable surface when baking the navigation mesh.
|
||
|
||
\ **Note:** The radius must be equal or higher than ``0.0``. If the radius is ``0.0``, it won't be possible to fix invalid outline overlaps and other precision errors during the baking process. As a result, some obstacles may be excluded incorrectly from the final navigation mesh, or may delete the navigation mesh's polygons.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_property_baking_rect:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Rect2<class_Rect2>` **baking_rect** = ``Rect2(0, 0, 0, 0)`` :ref:`🔗<class_NavigationPolygon_property_baking_rect>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_baking_rect**\ (\ value\: :ref:`Rect2<class_Rect2>`\ )
|
||
- :ref:`Rect2<class_Rect2>` **get_baking_rect**\ (\ )
|
||
|
||
Si la :ref:`Rect2<class_Rect2>` de pré-calcul a une aire, le pré-calcul du maillage de navigation sera limité à son aire englobante.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_property_baking_rect_offset:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Vector2<class_Vector2>` **baking_rect_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_NavigationPolygon_property_baking_rect_offset>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_baking_rect_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
|
||
- :ref:`Vector2<class_Vector2>` **get_baking_rect_offset**\ (\ )
|
||
|
||
Le décalage de position appliqué au :ref:`Rect2<class_Rect2>` de :ref:`baking_rect<class_NavigationPolygon_property_baking_rect>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_property_border_size:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **border_size** = ``0.0`` :ref:`🔗<class_NavigationPolygon_property_border_size>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_border_size**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_border_size**\ (\ )
|
||
|
||
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>`.
|
||
|
||
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>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_property_cell_size:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **cell_size** = ``1.0`` :ref:`🔗<class_NavigationPolygon_property_cell_size>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_cell_size**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_cell_size**\ (\ )
|
||
|
||
The cell size used to rasterize the navigation mesh vertices. Must match with the cell size on the navigation map.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_property_parsed_collision_mask:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **parsed_collision_mask** = ``4294967295`` :ref:`🔗<class_NavigationPolygon_property_parsed_collision_mask>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_parsed_collision_mask**\ (\ value\: :ref:`int<class_int>`\ )
|
||
- :ref:`int<class_int>` **get_parsed_collision_mask**\ (\ )
|
||
|
||
Les couches de physique à analyser pour des colliders statiques.
|
||
|
||
Seulement utilisé quand :ref:`parsed_geometry_type<class_NavigationPolygon_property_parsed_geometry_type>` vaut :ref:`PARSED_GEOMETRY_STATIC_COLLIDERS<class_NavigationPolygon_constant_PARSED_GEOMETRY_STATIC_COLLIDERS>` ou :ref:`PARSED_GEOMETRY_BOTH<class_NavigationPolygon_constant_PARSED_GEOMETRY_BOTH>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_property_parsed_geometry_type:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **parsed_geometry_type** = ``2`` :ref:`🔗<class_NavigationPolygon_property_parsed_geometry_type>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_parsed_geometry_type**\ (\ value\: :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>`\ )
|
||
- :ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **get_parsed_geometry_type**\ (\ )
|
||
|
||
Détermine quel type de nœuds seront parsés en tant que géométrie.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_property_sample_partition_type:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` **sample_partition_type** = ``0`` :ref:`🔗<class_NavigationPolygon_property_sample_partition_type>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_sample_partition_type**\ (\ value\: :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>`\ )
|
||
- :ref:`SamplePartitionType<enum_NavigationPolygon_SamplePartitionType>` **get_sample_partition_type**\ (\ )
|
||
|
||
Algorithme de partitionnement pour la création des polygones du maillage de navigation.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_property_source_geometry_group_name:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`StringName<class_StringName>` **source_geometry_group_name** = ``&"navigation_polygon_source_geometry_group"`` :ref:`🔗<class_NavigationPolygon_property_source_geometry_group_name>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_source_geometry_group_name**\ (\ value\: :ref:`StringName<class_StringName>`\ )
|
||
- :ref:`StringName<class_StringName>` **get_source_geometry_group_name**\ (\ )
|
||
|
||
The group name of nodes that should be parsed for baking source geometry.
|
||
|
||
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>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_property_source_geometry_mode:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **source_geometry_mode** = ``0`` :ref:`🔗<class_NavigationPolygon_property_source_geometry_mode>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_source_geometry_mode**\ (\ value\: :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>`\ )
|
||
- :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **get_source_geometry_mode**\ (\ )
|
||
|
||
La source de la géométrie utilisée lors du pré-calcul.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Descriptions des méthodes
|
||
--------------------------------------------------
|
||
|
||
.. _class_NavigationPolygon_method_add_outline:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **add_outline**\ (\ outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) :ref:`🔗<class_NavigationPolygon_method_add_outline>`
|
||
|
||
Ajoute un :ref:`PackedVector2Array<class_PackedVector2Array>` contenant les sommets d'un contour au tableau interne qui contient tous les contours.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_add_outline_at_index:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **add_outline_at_index**\ (\ outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`, index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_NavigationPolygon_method_add_outline_at_index>`
|
||
|
||
Ajoute un :ref:`PackedVector2Array<class_PackedVector2Array>` contenant les sommets d'un contour au tableau interne qui contient tous les contours à une position fixe.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_add_polygon:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **add_polygon**\ (\ polygon\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ ) :ref:`🔗<class_NavigationPolygon_method_add_polygon>`
|
||
|
||
Ajoute un polygone en utilisant les indices des sommets que obtenus avec :ref:`get_vertices()<class_NavigationPolygon_method_get_vertices>`.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_clear:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **clear**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_clear>`
|
||
|
||
Vide les tableaux internes pour les indices de sommets et de polygones.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_clear_outlines:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **clear_outlines**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_clear_outlines>`
|
||
|
||
Efface le tableau des contours, mais ça n'efface pas les sommets et les polygones qui ont été créés par eux.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_clear_polygons:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **clear_polygons**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_clear_polygons>`
|
||
|
||
Efface le tableau des polygones, mais ça n'effacera pas le tableau des contours et des sommets.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_get_navigation_mesh:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`NavigationMesh<class_NavigationMesh>` **get_navigation_mesh**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_get_navigation_mesh>`
|
||
|
||
Renvoie le :ref:`NavigationMesh<class_NavigationMesh>` résultant de ce polygone de navigation. Ce maillage de navigation peut être utilisé pour mettre à jour le maillage de navigation d'une région avec l'API :ref:`NavigationServer3D.region_set_navigation_mesh()<class_NavigationServer3D_method_region_set_navigation_mesh>` directement.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_get_outline:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedVector2Array<class_PackedVector2Array>` **get_outline**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationPolygon_method_get_outline>`
|
||
|
||
Renvoie un :ref:`PackedVector2Array<class_PackedVector2Array>` contenant les sommets d'un contour qui a été créé dans l'éditeur ou par un script.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_get_outline_count:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_outline_count**\ (\ ) |const| :ref:`🔗<class_NavigationPolygon_method_get_outline_count>`
|
||
|
||
Renvoie le nombre de contours qui ont été créés dans l'éditeur ou par un script.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_get_parsed_collision_mask_value:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
: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>`
|
||
|
||
Renvoie si la couche spécifiée du :ref:`parsed_collision_mask<class_NavigationPolygon_property_parsed_collision_mask>` est activée, étant donné un numéro de couche ``layer_number`` entre 1 et 32.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_get_polygon:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedInt32Array<class_PackedInt32Array>` **get_polygon**\ (\ idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_NavigationPolygon_method_get_polygon>`
|
||
|
||
Renvoie un :ref:`PackedInt32Array<class_PackedInt32Array>` contenant les indices des sommets d'un polygone créé.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_get_polygon_count:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_polygon_count**\ (\ ) |const| :ref:`🔗<class_NavigationPolygon_method_get_polygon_count>`
|
||
|
||
Renvoie le nombre de tous les polygones.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_get_vertices:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`PackedVector2Array<class_PackedVector2Array>` **get_vertices**\ (\ ) |const| :ref:`🔗<class_NavigationPolygon_method_get_vertices>`
|
||
|
||
Renvoie un :ref:`PackedVector2Array<class_PackedVector2Array>` contenant tous les sommets utilisés pour créer les polygones.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_make_polygons_from_outlines:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **make_polygons_from_outlines**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_make_polygons_from_outlines>`
|
||
|
||
**Obsolète :** 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.
|
||
|
||
Crée des polygones depuis les contours ajoutés dans l'éditeur ou par script.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_remove_outline:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **remove_outline**\ (\ idx\: :ref:`int<class_int>`\ ) :ref:`🔗<class_NavigationPolygon_method_remove_outline>`
|
||
|
||
Enlève un aperçu créé dans l'éditeur ou par un script. Vous devez appeler :ref:`make_polygons_from_outlines()<class_NavigationPolygon_method_make_polygons_from_outlines>` pour mettre à jour les polygones.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_set_outline:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_outline**\ (\ idx\: :ref:`int<class_int>`, outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) :ref:`🔗<class_NavigationPolygon_method_set_outline>`
|
||
|
||
Change un aperçu créé dans l'éditeur ou par un script. Vous devez appeler :ref:`make_polygons_from_outlines()<class_NavigationPolygon_method_make_polygons_from_outlines>` pour mettre à jour les polygones.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_set_parsed_collision_mask_value:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|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>`
|
||
|
||
Selon ``value``, active ou désactive la couche spécifiée dans le :ref:`parsed_collision_mask<class_NavigationPolygon_property_parsed_collision_mask>`, étant donné un numéro de couche ``layer_number`` entre 1 et 32.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_NavigationPolygon_method_set_vertices:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_vertices**\ (\ vertices\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) :ref:`🔗<class_NavigationPolygon_method_set_vertices>`
|
||
|
||
Définit les sommets qui peuvent ensuite être indexés pour créer des polygones avec la méthode :ref:`add_polygon()<class_NavigationPolygon_method_add_polygon>`.
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (Cette méthode doit typiquement être redéfinie par l'utilisateur pour avoir un effet.)`
|
||
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
||
.. |const| replace:: :abbr:`const (Cette méthode n'a pas d'effets de bord. Elle ne modifie aucune des variables membres de l'instance.)`
|
||
.. |vararg| replace:: :abbr:`vararg (Cette méthode accepte n'importe quel nombre d'arguments après ceux décris ici.)`
|
||
.. |constructor| replace:: :abbr:`constructor (Cette méthode est utilisée pour construire un type.)`
|
||
.. |static| replace:: :abbr:`static (Cette méthode n'a pas besoin d'instance pour être appelée, elle peut donc être directement appelée en utilisant le nom de la classe.)`
|
||
.. |operator| replace:: :abbr:`operator (Cette méthode décrit un opérateur valide à utiliser avec ce type en tant qu'opérande gauche.)`
|
||
.. |bitfield| replace:: :abbr:`BitField (Cette valeur est un nombre entier composé d'un masque de bits des options suivantes.)`
|
||
.. |void| replace:: :abbr:`void (Aucune valeur de retour.)`
|