Files
godot-docs-l10n/classes/it/class_navigationpolygon.rst
Rémi Verschelde c3f2364c10 Sync classref with 4.6 branch
Lots of translations invalidated (fuzzied) as we just synced Weblate.
2025-12-19 16:39:51 +01:00

694 lines
37 KiB
ReStructuredText

:github_url: hide
.. _class_NavigationPolygon:
NavigationPolygon
=================
**Sperimentale:** This class may be changed or removed in future versions.
**Eredita:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Una mesh di navigazione 2D che descrive una superficie attraversabile per la ricerca del percorso.
.. rst-class:: classref-introduction-group
Descrizione
----------------------
Una mesh di navigazione può essere creata sia preparandola con l'aiuto di :ref:`NavigationServer2D<class_NavigationServer2D>`, sia aggiungendo manualmente i vertici e gli array di indici dei poligoni convessi
Per preparare una mesh di navigazione è necessario aggiungere almeno un contorno che definisce i limiti esterni dell'area preparata.
.. 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;
Aggiungere manualmente i vertici e gli indici dei poligoni.
.. 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
Tutorial
----------------
- :doc:`Utilizzo dei NavigationMesh <../tutorials/navigation/navigation_using_navigationmeshes>`
- `Demo di poligono di navigazione 2D <https://godotengine.org/asset-library/asset/2722>`__
.. rst-class:: classref-reftable-group
Proprietà
------------------
.. 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
Metodi
------------
.. 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
Enumerazioni
------------------------
.. _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``
Rappresenta la dimensione dell'enumerazione :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``
Analizza le istanze di mesh come geometria di ostruzione.
Ciò include i nodi :ref:`Polygon2D<class_Polygon2D>`, :ref:`MeshInstance2D<class_MeshInstance2D>`, :ref:`MultiMeshInstance2D<class_MultiMeshInstance2D>` e :ref:`TileMap<class_TileMap>`. Le mesh sono analizzate solo quando utilizzano un formato di superficie con vertici 2D.
.. _class_NavigationPolygon_constant_PARSED_GEOMETRY_STATIC_COLLIDERS:
.. rst-class:: classref-enumeration-constant
:ref:`ParsedGeometryType<enum_NavigationPolygon_ParsedGeometryType>` **PARSED_GEOMETRY_STATIC_COLLIDERS** = ``1``
Analizza i collisori :ref:`StaticBody2D<class_StaticBody2D>` e :ref:`TileMap<class_TileMap>` come geometria di ostruzione. Il collisore deve trovarsi in uno qualsiasi degli strati specificati da :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``
Sia :ref:`PARSED_GEOMETRY_MESH_INSTANCES<class_NavigationPolygon_constant_PARSED_GEOMETRY_MESH_INSTANCES>` che :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``
Rappresenta la dimensione dell'enumerazione :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``
Scansiona ricorsivamente i nodi figlio del nodo radice per trovare la geometria.
.. _class_NavigationPolygon_constant_SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN:
.. rst-class:: classref-enumeration-constant
:ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>` **SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN** = ``1``
Scansiona ricorsivamente i nodi in un gruppo e dei loro nodi figlio per la geometria. Il gruppo è specificato da :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``
Utilizza i nodi in un gruppo per la geometria. Il gruppo è specificato da :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``
Rappresenta la dimensione dell'enumerazione :ref:`SourceGeometryMode<enum_NavigationPolygon_SourceGeometryMode>`.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Descrizioni delle proprietà
------------------------------------------------------
.. _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**\ (\ )
La distanza per erodere/restringere la superficie percorribile durante la preparazione della mesh di navigazione.
\ **Nota:** Il raggio deve essere uguale o superiore a ``0.0``. Se il raggio è ``0.0``, non sarà possibile correggere sovrapposizioni non valide tra contorni e altri errori di precisione durante il processo di preparazione. Di conseguenza, alcuni ostacoli potrebbero essere esclusi erroneamente dalla mesh di navigazione finale o potrebbero eliminare i poligoni della mesh di navigazione.
.. 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**\ (\ )
Se il :ref:`Rect2<class_Rect2>` di preparazione ha un'area, la preparazione della mesh di navigazione sarà limitata all'area che esso racchiude.
.. 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**\ (\ )
Lo scostamento di posizione applicato al :ref:`Rect2<class_Rect2>` di :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**\ (\ )
La dimensione del bordo non navigabile attorno all'area di delimitazione della preparazione definita dal :ref:`Rect2<class_Rect2>` :ref:`baking_rect<class_NavigationPolygon_property_baking_rect>`.
Insieme a :ref:`baking_rect<class_NavigationPolygon_property_baking_rect>`, la dimensione del bordo può essere utilizzata per preparare mesh di navigazione allineate ai tasselli senza che i bordi dei tasselli siano ridotti da :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**\ (\ )
La dimensione della cella utilizzata per rasterizzare i vertici della mesh di navigazione. Deve corrispondere alla dimensione della cella sulla mappa di navigazione.
.. 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**\ (\ )
Gli strati di fisica da scansionare per i collisori statici.
Utilizzato solo quando :ref:`parsed_geometry_type<class_NavigationPolygon_property_parsed_geometry_type>` è :ref:`PARSED_GEOMETRY_STATIC_COLLIDERS<class_NavigationPolygon_constant_PARSED_GEOMETRY_STATIC_COLLIDERS>` o :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**\ (\ )
Determina quale tipo di nodi sarà interpretato come geometria.
.. 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**\ (\ )
Algoritmo di partizionamento per la creazione dei poligoni della mesh di navigazione.
.. 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**\ (\ )
Il nome del gruppo di nodi che devono essere analizzati per preparare la geometria sorgente.
Utilizzato solo quando :ref:`source_geometry_mode<class_NavigationPolygon_property_source_geometry_mode>` è :ref:`SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN<class_NavigationPolygon_constant_SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN>` o :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 sorgente della geometria utilizzata durante la preparazione.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Descrizioni dei metodi
--------------------------------------------
.. _class_NavigationPolygon_method_add_outline:
.. rst-class:: classref-method
|void| **add_outline**\ (\ outline\: :ref:`PackedVector2Array<class_PackedVector2Array>`\ ) :ref:`🔗<class_NavigationPolygon_method_add_outline>`
Accoda un :ref:`PackedVector2Array<class_PackedVector2Array>` contenente i vertici di un contorno all'array interno che contiene tutti i contorni.
.. 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>`
Aggiunge un :ref:`PackedVector2Array<class_PackedVector2Array>` che contiene i vertici di un contorno all'array interno che contiene tutti i contorni in una posizione fissa.
.. 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>`
Aggiunge un poligono utilizzando gli indici dei vertici ottenuti chiamando :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>`
Svuota gli array interni per i vertici e gli indici dei poligoni.
.. rst-class:: classref-item-separator
----
.. _class_NavigationPolygon_method_clear_outlines:
.. rst-class:: classref-method
|void| **clear_outlines**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_clear_outlines>`
Cancella l'array dei contorni, ma non cancella i vertici e i poligoni da essi creati.
.. rst-class:: classref-item-separator
----
.. _class_NavigationPolygon_method_clear_polygons:
.. rst-class:: classref-method
|void| **clear_polygons**\ (\ ) :ref:`🔗<class_NavigationPolygon_method_clear_polygons>`
Cancella l'array dei poligoni, ma non cancella l'array dei contorni e dei vertici.
.. 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>`
Restituisce il :ref:`NavigationMesh<class_NavigationMesh>` risultante da questo poligono di navigazione. È possibile utilizzare questa mesh di navigazione per aggiornare la mesh di navigazione di una regione con l'API :ref:`NavigationServer3D.region_set_navigation_mesh()<class_NavigationServer3D_method_region_set_navigation_mesh>` direttamente.
.. 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>`
Restituisce un :ref:`PackedVector2Array<class_PackedVector2Array>` contenente i vertici di un contorno che è stato creato nell'editor o tramite 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>`
Restituisce il numero di contorni che sono stati creati nell'editor o tramite 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>`
Restituisce se lo strato specificato del :ref:`parsed_collision_mask<class_NavigationPolygon_property_parsed_collision_mask>` è abilitato, dato un ``layer_number`` tra 1 e 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>`
Restituisce un :ref:`PackedInt32Array<class_PackedInt32Array>` contenente gli indici dei vertici di un poligono creato.
.. 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>`
Restituisce il numero di tutti i poligoni.
.. 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>`
Restituisce un :ref:`PackedVector2Array<class_PackedVector2Array>` contenente tutti i vertici utilizzati per creare i poligoni.
.. 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>`
**Deprecato:** 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.
Crea poligoni dai contorni aggiunti nell'editor o tramite 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>`
Rimuove un contorno creato nell'editor o tramite script. È necessario chiamare :ref:`make_polygons_from_outlines()<class_NavigationPolygon_method_make_polygons_from_outlines>` per aggiornare i poligoni.
.. 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>`
Modifica un contorno creato nell'editor o tramite script. È necessario chiamare :ref:`make_polygons_from_outlines()<class_NavigationPolygon_method_make_polygons_from_outlines>` per aggiornare i poligoni.
.. 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>`
Basato su ``value``, attiva o disattiva lo strato specificato nel :ref:`parsed_collision_mask<class_NavigationPolygon_property_parsed_collision_mask>`, dato un ``layer_number`` tra 1 e 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>`
Imposta i vertici che possono essere poi indicizzati per creare poligoni con il metodo :ref:`add_polygon()<class_NavigationPolygon_method_add_polygon>`.
.. |virtual| replace:: :abbr:`virtual (Questo metodo dovrebbe solitamente essere sovrascritto dall'utente per aver un effetto.)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (Questo metodo non ha effetti collaterali. Non modifica alcuna variabile appartenente all'istanza.)`
.. |vararg| replace:: :abbr:`vararg (Questo metodo accetta qualsiasi numero di argomenti oltre a quelli descritti qui.)`
.. |constructor| replace:: :abbr:`constructor (Questo metodo è utilizzato per creare un tipo.)`
.. |static| replace:: :abbr:`static (Questo metodo non necessita di alcun'istanza per essere chiamato, quindi può essere chiamato direttamente usando il nome della classe.)`
.. |operator| replace:: :abbr:`operator (Questo metodo descrive un operatore valido da usare con questo tipo come operando di sinistra.)`
.. |bitfield| replace:: :abbr:`BitField (Questo valore è un intero composto da una maschera di bit dei seguenti flag.)`
.. |void| replace:: :abbr:`void (Nessun valore restituito.)`