123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/NavigationObstacle2D.xml.
- .. _class_NavigationObstacle2D:
- NavigationObstacle2D
- ====================
- **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- 2D Obstacle used in navigation to constrain avoidance controlled agents outside or inside an area.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- 2D Obstacle used in navigation to constrain avoidance controlled agents outside or inside an area. The obstacle needs a navigation map and outline vertices defined to work correctly.
- If the obstacle's vertices are winded in clockwise order, avoidance agents will be pushed in by the obstacle, otherwise, avoidance agents will be pushed out. Outlines must not cross or overlap.
- Obstacles are **not** a replacement for a (re)baked navigation mesh. Obstacles **don't** change the resulting path from the pathfinding, obstacles only affect the navigation avoidance agent movement by altering the suggested velocity of the avoidance agent.
- Obstacles using vertices can warp to a new position but should not moved every frame as each move requires a rebuild of the avoidance map.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - :doc:`Using NavigationObstacles <../tutorials/navigation/navigation_using_navigationobstacles>`
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
- | :ref:`bool<class_bool>` | :ref:`avoidance_enabled<class_NavigationObstacle2D_property_avoidance_enabled>` | ``true`` |
- +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
- | :ref:`int<class_int>` | :ref:`avoidance_layers<class_NavigationObstacle2D_property_avoidance_layers>` | ``1`` |
- +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
- | :ref:`float<class_float>` | :ref:`radius<class_NavigationObstacle2D_property_radius>` | ``0.0`` |
- +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
- | :ref:`Vector2<class_Vector2>` | :ref:`velocity<class_NavigationObstacle2D_property_velocity>` | ``Vector2(0, 0)`` |
- +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
- | :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`vertices<class_NavigationObstacle2D_property_vertices>` | ``PackedVector2Array()`` |
- +-----------------------------------------------------+---------------------------------------------------------------------------------+--------------------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`get_avoidance_layer_value<class_NavigationObstacle2D_method_get_avoidance_layer_value>` **(** :ref:`int<class_int>` layer_number **)** |const| |
- +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_NavigationObstacle2D_method_get_navigation_map>` **(** **)** |const| |
- +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`RID<class_RID>` | :ref:`get_rid<class_NavigationObstacle2D_method_get_rid>` **(** **)** |const| |
- +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_avoidance_layer_value<class_NavigationObstacle2D_method_set_avoidance_layer_value>` **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)** |
- +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_navigation_map<class_NavigationObstacle2D_method_set_navigation_map>` **(** :ref:`RID<class_RID>` navigation_map **)** |
- +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_NavigationObstacle2D_property_avoidance_enabled:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **avoidance_enabled** = ``true``
- .. rst-class:: classref-property-setget
- - void **set_avoidance_enabled** **(** :ref:`bool<class_bool>` value **)**
- - :ref:`bool<class_bool>` **get_avoidance_enabled** **(** **)**
- If ``true`` the obstacle affects avoidance using agents.
- .. rst-class:: classref-item-separator
- ----
- .. _class_NavigationObstacle2D_property_avoidance_layers:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **avoidance_layers** = ``1``
- .. rst-class:: classref-property-setget
- - void **set_avoidance_layers** **(** :ref:`int<class_int>` value **)**
- - :ref:`int<class_int>` **get_avoidance_layers** **(** **)**
- A bitfield determining the avoidance layers for this obstacle. Agents with a matching bit on the their avoidance mask will avoid this obstacle.
- .. rst-class:: classref-item-separator
- ----
- .. _class_NavigationObstacle2D_property_radius:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **radius** = ``0.0``
- .. rst-class:: classref-property-setget
- - void **set_radius** **(** :ref:`float<class_float>` value **)**
- - :ref:`float<class_float>` **get_radius** **(** **)**
- Sets the avoidance radius for the obstacle.
- .. rst-class:: classref-item-separator
- ----
- .. _class_NavigationObstacle2D_property_velocity:
- .. rst-class:: classref-property
- :ref:`Vector2<class_Vector2>` **velocity** = ``Vector2(0, 0)``
- .. rst-class:: classref-property-setget
- - void **set_velocity** **(** :ref:`Vector2<class_Vector2>` value **)**
- - :ref:`Vector2<class_Vector2>` **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_NavigationObstacle2D_property_radius>`. Does nothing for the obstacles static vertices.
- .. rst-class:: classref-item-separator
- ----
- .. _class_NavigationObstacle2D_property_vertices:
- .. rst-class:: classref-property
- :ref:`PackedVector2Array<class_PackedVector2Array>` **vertices** = ``PackedVector2Array()``
- .. rst-class:: classref-property-setget
- - void **set_vertices** **(** :ref:`PackedVector2Array<class_PackedVector2Array>` value **)**
- - :ref:`PackedVector2Array<class_PackedVector2Array>` **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.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_NavigationObstacle2D_method_get_avoidance_layer_value:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **get_avoidance_layer_value** **(** :ref:`int<class_int>` layer_number **)** |const|
- Returns whether or not the specified layer of the :ref:`avoidance_layers<class_NavigationObstacle2D_property_avoidance_layers>` bitmask is enabled, given a ``layer_number`` between 1 and 32.
- .. rst-class:: classref-item-separator
- ----
- .. _class_NavigationObstacle2D_method_get_navigation_map:
- .. rst-class:: classref-method
- :ref:`RID<class_RID>` **get_navigation_map** **(** **)** |const|
- Returns the :ref:`RID<class_RID>` of the navigation map for this NavigationObstacle node. This function returns always the map set on the NavigationObstacle node and not the map of the abstract obstacle on the NavigationServer. If the obstacle map is changed directly with the NavigationServer API the NavigationObstacle node will not be aware of the map change. Use :ref:`set_navigation_map<class_NavigationObstacle2D_method_set_navigation_map>` to change the navigation map for the NavigationObstacle and also update the obstacle on the NavigationServer.
- .. rst-class:: classref-item-separator
- ----
- .. _class_NavigationObstacle2D_method_get_rid:
- .. rst-class:: classref-method
- :ref:`RID<class_RID>` **get_rid** **(** **)** |const|
- Returns the :ref:`RID<class_RID>` of this obstacle on the :ref:`NavigationServer2D<class_NavigationServer2D>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_NavigationObstacle2D_method_set_avoidance_layer_value:
- .. rst-class:: classref-method
- void **set_avoidance_layer_value** **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)**
- Based on ``value``, enables or disables the specified layer in the :ref:`avoidance_layers<class_NavigationObstacle2D_property_avoidance_layers>` bitmask, given a ``layer_number`` between 1 and 32.
- .. rst-class:: classref-item-separator
- ----
- .. _class_NavigationObstacle2D_method_set_navigation_map:
- .. rst-class:: classref-method
- void **set_navigation_map** **(** :ref:`RID<class_RID>` navigation_map **)**
- Sets the :ref:`RID<class_RID>` of the navigation map this NavigationObstacle node should use and also updates the ``obstacle`` on the NavigationServer.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|