178 lines
7.9 KiB
ReStructuredText
178 lines
7.9 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/NavigationPolygonInstance.xml.
|
|
|
|
.. _class_NavigationPolygonInstance:
|
|
|
|
NavigationPolygonInstance
|
|
=========================
|
|
|
|
**Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
|
|
|
A region of the 2D navigation map.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
A region of the navigation map. It tells the :ref:`Navigation2DServer<class_Navigation2DServer>` what can be navigated and what cannot, based on its :ref:`NavigationPolygon<class_NavigationPolygon>` resource.
|
|
|
|
By default this node will register to the default :ref:`World2D<class_World2D>` navigation map. If this node is a child of a :ref:`Navigation2D<class_Navigation2D>` node it will register to the navigation map of the navigation node.
|
|
|
|
Two regions can be connected to each other if they share a similar edge. You can set the minimum distance between two vertices required to connect two edges by using :ref:`Navigation2DServer.map_set_edge_connection_margin<class_Navigation2DServer_method_map_set_edge_connection_margin>`.
|
|
|
|
\ **Note:** Overlapping two regions' polygons is not enough for connecting two regions. They must share a similar edge.
|
|
|
|
The pathfinding cost of entering this region from another region can be controlled with the :ref:`enter_cost<class_NavigationPolygonInstance_property_enter_cost>` value.
|
|
|
|
\ **Note:** This value is not added to the path cost when the start position is already inside this region.
|
|
|
|
The pathfinding cost of traveling distances inside this region can be controlled with the :ref:`travel_cost<class_NavigationPolygonInstance_property_travel_cost>` multiplier.
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Properties
|
|
----------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
|
|
| :ref:`bool<class_bool>` | :ref:`enabled<class_NavigationPolygonInstance_property_enabled>` | ``true`` |
|
|
+---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
|
|
| :ref:`float<class_float>` | :ref:`enter_cost<class_NavigationPolygonInstance_property_enter_cost>` | ``0.0`` |
|
|
+---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
|
|
| :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationPolygonInstance_property_navigation_layers>` | ``1`` |
|
|
+---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
|
|
| :ref:`NavigationPolygon<class_NavigationPolygon>` | :ref:`navpoly<class_NavigationPolygonInstance_property_navpoly>` | |
|
|
+---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
|
|
| :ref:`float<class_float>` | :ref:`travel_cost<class_NavigationPolygonInstance_property_travel_cost>` | ``1.0`` |
|
|
+---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Methods
|
|
-------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------+--------------------------------------------------------------------------------------------------+
|
|
| :ref:`RID<class_RID>` | :ref:`get_region_rid<class_NavigationPolygonInstance_method_get_region_rid>` **(** **)** |const| |
|
|
+-----------------------+--------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_NavigationPolygonInstance_property_enabled:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **enabled** = ``true``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_enabled** **(** :ref:`bool<class_bool>` value **)**
|
|
- :ref:`bool<class_bool>` **is_enabled** **(** **)**
|
|
|
|
Determines if the **NavigationPolygonInstance** is enabled or disabled.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_NavigationPolygonInstance_property_enter_cost:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **enter_cost** = ``0.0``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_enter_cost** **(** :ref:`float<class_float>` value **)**
|
|
- :ref:`float<class_float>` **get_enter_cost** **(** **)**
|
|
|
|
When pathfinding enters this region's navmesh from another regions navmesh the ``enter_cost`` value is added to the path distance for determining the shortest path.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_NavigationPolygonInstance_property_navigation_layers:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **navigation_layers** = ``1``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_navigation_layers** **(** :ref:`int<class_int>` value **)**
|
|
- :ref:`int<class_int>` **get_navigation_layers** **(** **)**
|
|
|
|
A bitfield determining all navigation map layers the :ref:`NavigationPolygon<class_NavigationPolygon>` belongs to. On path requests with :ref:`Navigation2DServer.map_get_path<class_Navigation2DServer_method_map_get_path>` navmeshes without matching layers will be ignored and the navigation map will only proximity merge different navmeshes with matching layers.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_NavigationPolygonInstance_property_navpoly:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`NavigationPolygon<class_NavigationPolygon>` **navpoly**
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_navigation_polygon** **(** :ref:`NavigationPolygon<class_NavigationPolygon>` value **)**
|
|
- :ref:`NavigationPolygon<class_NavigationPolygon>` **get_navigation_polygon** **(** **)**
|
|
|
|
The :ref:`NavigationPolygon<class_NavigationPolygon>` resource to use.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_NavigationPolygonInstance_property_travel_cost:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **travel_cost** = ``1.0``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_travel_cost** **(** :ref:`float<class_float>` value **)**
|
|
- :ref:`float<class_float>` **get_travel_cost** **(** **)**
|
|
|
|
When pathfinding moves inside this region's navmesh the traveled distances are multiplied with ``travel_cost`` for determining the shortest path.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_NavigationPolygonInstance_method_get_region_rid:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`RID<class_RID>` **get_region_rid** **(** **)** |const|
|
|
|
|
Returns the :ref:`RID<class_RID>` of this region on the :ref:`Navigation2DServer<class_Navigation2DServer>`. Combined with :ref:`Navigation2DServer.map_get_closest_point_owner<class_Navigation2DServer_method_map_get_closest_point_owner>` can be used to identify the **NavigationPolygonInstance** closest to a point on the merged navigation map.
|
|
|
|
.. |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.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|