class_navigationpolygoninstance.rst 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/NavigationPolygonInstance.xml.
  6. .. _class_NavigationPolygonInstance:
  7. NavigationPolygonInstance
  8. =========================
  9. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A region of the 2D navigation map.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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.
  15. 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.
  16. 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>`.
  17. \ **Note:** Overlapping two regions' polygons is not enough for connecting two regions. They must share a similar edge.
  18. The pathfinding cost of entering this region from another region can be controlled with the :ref:`enter_cost<class_NavigationPolygonInstance_property_enter_cost>` value.
  19. \ **Note:** This value is not added to the path cost when the start position is already inside this region.
  20. The pathfinding cost of traveling distances inside this region can be controlled with the :ref:`travel_cost<class_NavigationPolygonInstance_property_travel_cost>` multiplier.
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
  27. | :ref:`bool<class_bool>` | :ref:`enabled<class_NavigationPolygonInstance_property_enabled>` | ``true`` |
  28. +---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
  29. | :ref:`float<class_float>` | :ref:`enter_cost<class_NavigationPolygonInstance_property_enter_cost>` | ``0.0`` |
  30. +---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
  31. | :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationPolygonInstance_property_navigation_layers>` | ``1`` |
  32. +---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
  33. | :ref:`NavigationPolygon<class_NavigationPolygon>` | :ref:`navpoly<class_NavigationPolygonInstance_property_navpoly>` | |
  34. +---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
  35. | :ref:`float<class_float>` | :ref:`travel_cost<class_NavigationPolygonInstance_property_travel_cost>` | ``1.0`` |
  36. +---------------------------------------------------+--------------------------------------------------------------------------------------+----------+
  37. .. rst-class:: classref-reftable-group
  38. Methods
  39. -------
  40. .. table::
  41. :widths: auto
  42. +-----------------------+--------------------------------------------------------------------------------------------------+
  43. | :ref:`RID<class_RID>` | :ref:`get_region_rid<class_NavigationPolygonInstance_method_get_region_rid>` **(** **)** |const| |
  44. +-----------------------+--------------------------------------------------------------------------------------------------+
  45. .. rst-class:: classref-section-separator
  46. ----
  47. .. rst-class:: classref-descriptions-group
  48. Property Descriptions
  49. ---------------------
  50. .. _class_NavigationPolygonInstance_property_enabled:
  51. .. rst-class:: classref-property
  52. :ref:`bool<class_bool>` **enabled** = ``true``
  53. .. rst-class:: classref-property-setget
  54. - void **set_enabled** **(** :ref:`bool<class_bool>` value **)**
  55. - :ref:`bool<class_bool>` **is_enabled** **(** **)**
  56. Determines if the **NavigationPolygonInstance** is enabled or disabled.
  57. .. rst-class:: classref-item-separator
  58. ----
  59. .. _class_NavigationPolygonInstance_property_enter_cost:
  60. .. rst-class:: classref-property
  61. :ref:`float<class_float>` **enter_cost** = ``0.0``
  62. .. rst-class:: classref-property-setget
  63. - void **set_enter_cost** **(** :ref:`float<class_float>` value **)**
  64. - :ref:`float<class_float>` **get_enter_cost** **(** **)**
  65. 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.
  66. .. rst-class:: classref-item-separator
  67. ----
  68. .. _class_NavigationPolygonInstance_property_navigation_layers:
  69. .. rst-class:: classref-property
  70. :ref:`int<class_int>` **navigation_layers** = ``1``
  71. .. rst-class:: classref-property-setget
  72. - void **set_navigation_layers** **(** :ref:`int<class_int>` value **)**
  73. - :ref:`int<class_int>` **get_navigation_layers** **(** **)**
  74. 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.
  75. .. rst-class:: classref-item-separator
  76. ----
  77. .. _class_NavigationPolygonInstance_property_navpoly:
  78. .. rst-class:: classref-property
  79. :ref:`NavigationPolygon<class_NavigationPolygon>` **navpoly**
  80. .. rst-class:: classref-property-setget
  81. - void **set_navigation_polygon** **(** :ref:`NavigationPolygon<class_NavigationPolygon>` value **)**
  82. - :ref:`NavigationPolygon<class_NavigationPolygon>` **get_navigation_polygon** **(** **)**
  83. The :ref:`NavigationPolygon<class_NavigationPolygon>` resource to use.
  84. .. rst-class:: classref-item-separator
  85. ----
  86. .. _class_NavigationPolygonInstance_property_travel_cost:
  87. .. rst-class:: classref-property
  88. :ref:`float<class_float>` **travel_cost** = ``1.0``
  89. .. rst-class:: classref-property-setget
  90. - void **set_travel_cost** **(** :ref:`float<class_float>` value **)**
  91. - :ref:`float<class_float>` **get_travel_cost** **(** **)**
  92. When pathfinding moves inside this region's navmesh the traveled distances are multiplied with ``travel_cost`` for determining the shortest path.
  93. .. rst-class:: classref-section-separator
  94. ----
  95. .. rst-class:: classref-descriptions-group
  96. Method Descriptions
  97. -------------------
  98. .. _class_NavigationPolygonInstance_method_get_region_rid:
  99. .. rst-class:: classref-method
  100. :ref:`RID<class_RID>` **get_region_rid** **(** **)** |const|
  101. 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.
  102. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  103. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  104. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  105. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`