Files
godot-docs-l10n/classes/fr/class_navigationobstacle3d.rst
2025-12-19 14:34:07 +01:00

320 lines
18 KiB
ReStructuredText
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_NavigationObstacle3D:
NavigationObstacle3D
====================
**Expérimental:** This class may be changed or removed in future versions.
**Hérite de:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
Obstacle 3D utilisé pour affecter le pré-calcul d'un maillage de navigation ou limiter les vitesses des agents utilisant de l'évitement.
.. rst-class:: classref-introduction-group
Description
-----------
An obstacle needs a navigation map and outline :ref:`vertices<class_NavigationObstacle3D_property_vertices>` defined to work correctly. The outlines can not cross or overlap and are restricted to a plane projection. This means the y-axis of the vertices is ignored, instead the obstacle's global y-axis position is used for placement. The projected shape is extruded by the obstacles height along the y-axis.
Obstacles can be included in the navigation mesh baking process when :ref:`affect_navigation_mesh<class_NavigationObstacle3D_property_affect_navigation_mesh>` is enabled. They do not add walkable geometry, instead their role is to discard other source geometry inside the shape. This can be used to prevent navigation mesh from appearing in unwanted places, e.g. inside "solid" geometry or on top of it. If :ref:`carve_navigation_mesh<class_NavigationObstacle3D_property_carve_navigation_mesh>` is enabled the baked shape will not be affected by offsets of the navigation mesh baking, e.g. the agent radius.
With :ref:`avoidance_enabled<class_NavigationObstacle3D_property_avoidance_enabled>` the obstacle can constrain the avoidance velocities of avoidance using agents. If the obstacle's vertices are wound in clockwise order, avoidance agents will be pushed in by the obstacle, otherwise, avoidance agents will be pushed out. Obstacles using vertices and avoidance can warp to a new position but should not be moved every single frame as each change requires a rebuild of the avoidance map.
.. rst-class:: classref-introduction-group
Tutoriels
------------------
- :doc:`Utilisation de NavigationObstacles <../tutorials/navigation/navigation_using_navigationobstacles>`
.. rst-class:: classref-reftable-group
Propriétés
--------------------
.. table::
:widths: auto
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
| :ref:`bool<class_bool>` | :ref:`affect_navigation_mesh<class_NavigationObstacle3D_property_affect_navigation_mesh>` | ``false`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
| :ref:`bool<class_bool>` | :ref:`avoidance_enabled<class_NavigationObstacle3D_property_avoidance_enabled>` | ``true`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
| :ref:`int<class_int>` | :ref:`avoidance_layers<class_NavigationObstacle3D_property_avoidance_layers>` | ``1`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
| :ref:`bool<class_bool>` | :ref:`carve_navigation_mesh<class_NavigationObstacle3D_property_carve_navigation_mesh>` | ``false`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
| :ref:`float<class_float>` | :ref:`height<class_NavigationObstacle3D_property_height>` | ``1.0`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
| :ref:`float<class_float>` | :ref:`radius<class_NavigationObstacle3D_property_radius>` | ``0.0`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
| :ref:`bool<class_bool>` | :ref:`use_3d_avoidance<class_NavigationObstacle3D_property_use_3d_avoidance>` | ``false`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`velocity<class_NavigationObstacle3D_property_velocity>` | ``Vector3(0, 0, 0)`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
| :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`vertices<class_NavigationObstacle3D_property_vertices>` | ``PackedVector3Array()`` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------+--------------------------+
.. rst-class:: classref-reftable-group
Méthodes
----------------
.. table::
:widths: auto
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_avoidance_layer_value<class_NavigationObstacle3D_method_get_avoidance_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_NavigationObstacle3D_method_get_navigation_map>`\ (\ ) |const| |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`get_rid<class_NavigationObstacle3D_method_get_rid>`\ (\ ) |const| |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_avoidance_layer_value<class_NavigationObstacle3D_method_set_avoidance_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_navigation_map<class_NavigationObstacle3D_method_set_navigation_map>`\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Descriptions des propriétés
------------------------------------------------------
.. _class_NavigationObstacle3D_property_affect_navigation_mesh:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **affect_navigation_mesh** = ``false`` :ref:`🔗<class_NavigationObstacle3D_property_affect_navigation_mesh>`
.. rst-class:: classref-property-setget
- |void| **set_affect_navigation_mesh**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_affect_navigation_mesh**\ (\ )
Si activé et parsé dans un pré-calcul de maillage de navigation, l'obstacle supprimera la géométrie source à l'intérieur de sa forme définie par :ref:`vertices<class_NavigationObstacle3D_property_vertices>` et :ref:`height<class_NavigationObstacle3D_property_height>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_property_avoidance_enabled:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **avoidance_enabled** = ``true`` :ref:`🔗<class_NavigationObstacle3D_property_avoidance_enabled>`
.. rst-class:: classref-property-setget
- |void| **set_avoidance_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_avoidance_enabled**\ (\ )
Si ``true``, l'obstacle affecte les agents utilisant de l'évitement.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_property_avoidance_layers:
.. rst-class:: classref-property
:ref:`int<class_int>` **avoidance_layers** = ``1`` :ref:`🔗<class_NavigationObstacle3D_property_avoidance_layers>`
.. rst-class:: classref-property-setget
- |void| **set_avoidance_layers**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_avoidance_layers**\ (\ )
Un bitfield déterminant les couches d'évitement pour cet obstacle. Les agents avec un bit correspondant sur leur masque d'évitement éviteront cet obstacle.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_property_carve_navigation_mesh:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **carve_navigation_mesh** = ``false`` :ref:`🔗<class_NavigationObstacle3D_property_carve_navigation_mesh>`
.. rst-class:: classref-property-setget
- |void| **set_carve_navigation_mesh**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_carve_navigation_mesh**\ (\ )
If enabled the obstacle vertices will carve into the baked navigation mesh with the shape unaffected by additional offsets (e.g. agent radius).
It will still be affected by further postprocessing of the baking process, like edge and polygon simplification.
Requires :ref:`affect_navigation_mesh<class_NavigationObstacle3D_property_affect_navigation_mesh>` to be enabled.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_property_height:
.. rst-class:: classref-property
:ref:`float<class_float>` **height** = ``1.0`` :ref:`🔗<class_NavigationObstacle3D_property_height>`
.. rst-class:: classref-property-setget
- |void| **set_height**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_height**\ (\ )
Définit la hauteur de l'obstacle utilisée dans l'évitement 2D. Les agents utilisant de l'évitement 2D ignorent les obstacles qui sont en dessous ou au dessus d'eux.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_property_radius:
.. rst-class:: classref-property
:ref:`float<class_float>` **radius** = ``0.0`` :ref:`🔗<class_NavigationObstacle3D_property_radius>`
.. rst-class:: classref-property-setget
- |void| **set_radius**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_radius**\ (\ )
Définit le rayon d'évitement pour l'obstacle.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_property_use_3d_avoidance:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **use_3d_avoidance** = ``false`` :ref:`🔗<class_NavigationObstacle3D_property_use_3d_avoidance>`
.. rst-class:: classref-property-setget
- |void| **set_use_3d_avoidance**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_use_3d_avoidance**\ (\ )
If ``true`` the obstacle affects 3D avoidance using agent's with obstacle :ref:`radius<class_NavigationObstacle3D_property_radius>`.
If ``false`` the obstacle affects 2D avoidance using agent's with both obstacle :ref:`vertices<class_NavigationObstacle3D_property_vertices>` as well as obstacle :ref:`radius<class_NavigationObstacle3D_property_radius>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_property_velocity:
.. rst-class:: classref-property
:ref:`Vector3<class_Vector3>` **velocity** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_NavigationObstacle3D_property_velocity>`
.. rst-class:: classref-property-setget
- |void| **set_velocity**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
- :ref:`Vector3<class_Vector3>` **get_velocity**\ (\ )
Sets the wanted velocity for the obstacle so other agent's can better predict the obstacle if it is moved with a velocity regularly (every frame) instead of warped to a new position. Does only affect avoidance for the obstacles :ref:`radius<class_NavigationObstacle3D_property_radius>`. Does nothing for the obstacles static vertices.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_property_vertices:
.. rst-class:: classref-property
:ref:`PackedVector3Array<class_PackedVector3Array>` **vertices** = ``PackedVector3Array()`` :ref:`🔗<class_NavigationObstacle3D_property_vertices>`
.. rst-class:: classref-property-setget
- |void| **set_vertices**\ (\ value\: :ref:`PackedVector3Array<class_PackedVector3Array>`\ )
- :ref:`PackedVector3Array<class_PackedVector3Array>` **get_vertices**\ (\ )
The outline vertices of the obstacle. If the vertices are winded in clockwise order agents will be pushed in by the obstacle, else they will be pushed out. Outlines can not be crossed or overlap. Should the vertices using obstacle be warped to a new position agent's can not predict this movement and may get trapped inside the obstacle.
**Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedVector3Array<class_PackedVector3Array>` for more details.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Descriptions des méthodes
--------------------------------------------------
.. _class_NavigationObstacle3D_method_get_avoidance_layer_value:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **get_avoidance_layer_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_NavigationObstacle3D_method_get_avoidance_layer_value>`
Renvoie si la couche spécifiée du masque de bits :ref:`avoidance_layers<class_NavigationObstacle3D_property_avoidance_layers>` est activée, étant donné un numéro de couche ``layer_number`` entre 1 et 32.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_method_get_navigation_map:
.. rst-class:: classref-method
:ref:`RID<class_RID>` **get_navigation_map**\ (\ ) |const| :ref:`🔗<class_NavigationObstacle3D_method_get_navigation_map>`
Renvoie le :ref:`RID<class_RID>` de la carte de navigation pour ce nœud NavigationObstacle. Cette fonction renvoie toujours la carte définie sur le nœud NavigationObstacle et non la carte de l'obstacle abstrait sur le NavigationServer. Si la carte de l'obstacle est changée directement avec l'API de NavigationServer, le nœud NavigationObstacle ne sera pas au courant du changement de carte. Utilisez :ref:`set_navigation_map()<class_NavigationObstacle3D_method_set_navigation_map>` pour changer la carte de navigation pour le NavigationObstacle et mettre aussi à jour l'obstacle sur le NavigationServer.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_method_get_rid:
.. rst-class:: classref-method
:ref:`RID<class_RID>` **get_rid**\ (\ ) |const| :ref:`🔗<class_NavigationObstacle3D_method_get_rid>`
Renvoie le :ref:`RID<class_RID>` de cet obstacle sur le :ref:`NavigationServer3D<class_NavigationServer3D>`.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_method_set_avoidance_layer_value:
.. rst-class:: classref-method
|void| **set_avoidance_layer_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_NavigationObstacle3D_method_set_avoidance_layer_value>`
Selon ``value``, active ou désactive la couche spécifiée dans le masque de bits :ref:`avoidance_layers<class_NavigationObstacle3D_property_avoidance_layers>`, étant donné un numéro de couche ``layer_number`` entre 1 et 32.
.. rst-class:: classref-item-separator
----
.. _class_NavigationObstacle3D_method_set_navigation_map:
.. rst-class:: classref-method
|void| **set_navigation_map**\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) :ref:`🔗<class_NavigationObstacle3D_method_set_navigation_map>`
Définit le :ref:`RID<class_RID>` de la carte de navigation que ce nœud NavigationObstacle devrait utiliser et met à jour l'``agent`` sur le NavigationServer.
.. |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.)`