class_navigationmeshinstance.rst 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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/NavigationMeshInstance.xml.
  6. .. _class_NavigationMeshInstance:
  7. NavigationMeshInstance
  8. ======================
  9. **Inherits:** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. An instance of a :ref:`NavigationMesh<class_NavigationMesh>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. An instance of a :ref:`NavigationMesh<class_NavigationMesh>`. It tells the :ref:`Navigation<class_Navigation>` node what can be navigated and what cannot, based on the :ref:`NavigationMesh<class_NavigationMesh>` resource.
  15. By default this node will register to the default :ref:`World<class_World>` navigation map. If this node is a child of a :ref:`Navigation<class_Navigation>` 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:`NavigationServer.map_set_edge_connection_margin<class_NavigationServer_method_map_set_edge_connection_margin>`.
  17. \ **Note:** Overlapping two regions' navmeshes is not enough for connecting two regions. They must share a similar edge.
  18. The cost of entering this region from another region can be controlled with the :ref:`enter_cost<class_NavigationMeshInstance_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 cost of traveling distances inside this region can be controlled with the :ref:`travel_cost<class_NavigationMeshInstance_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_NavigationMeshInstance_property_enabled>` | ``true`` |
  28. +---------------------------------------------+-----------------------------------------------------------------------------------+----------+
  29. | :ref:`float<class_float>` | :ref:`enter_cost<class_NavigationMeshInstance_property_enter_cost>` | ``0.0`` |
  30. +---------------------------------------------+-----------------------------------------------------------------------------------+----------+
  31. | :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationMeshInstance_property_navigation_layers>` | ``1`` |
  32. +---------------------------------------------+-----------------------------------------------------------------------------------+----------+
  33. | :ref:`NavigationMesh<class_NavigationMesh>` | :ref:`navmesh<class_NavigationMeshInstance_property_navmesh>` | |
  34. +---------------------------------------------+-----------------------------------------------------------------------------------+----------+
  35. | :ref:`float<class_float>` | :ref:`travel_cost<class_NavigationMeshInstance_property_travel_cost>` | ``1.0`` |
  36. +---------------------------------------------+-----------------------------------------------------------------------------------+----------+
  37. .. rst-class:: classref-reftable-group
  38. Methods
  39. -------
  40. .. table::
  41. :widths: auto
  42. +-----------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`bake_navigation_mesh<class_NavigationMeshInstance_method_bake_navigation_mesh>` **(** :ref:`bool<class_bool>` on_thread=true **)** |
  44. +-----------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`RID<class_RID>` | :ref:`get_region_rid<class_NavigationMeshInstance_method_get_region_rid>` **(** **)** |const| |
  46. +-----------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  47. .. rst-class:: classref-section-separator
  48. ----
  49. .. rst-class:: classref-descriptions-group
  50. Signals
  51. -------
  52. .. _class_NavigationMeshInstance_signal_bake_finished:
  53. .. rst-class:: classref-signal
  54. **bake_finished** **(** **)**
  55. Notifies when the navigation mesh bake operation is completed.
  56. .. rst-class:: classref-item-separator
  57. ----
  58. .. _class_NavigationMeshInstance_signal_navigation_mesh_changed:
  59. .. rst-class:: classref-signal
  60. **navigation_mesh_changed** **(** **)**
  61. Notifies when the :ref:`NavigationMesh<class_NavigationMesh>` has changed.
  62. .. rst-class:: classref-section-separator
  63. ----
  64. .. rst-class:: classref-descriptions-group
  65. Property Descriptions
  66. ---------------------
  67. .. _class_NavigationMeshInstance_property_enabled:
  68. .. rst-class:: classref-property
  69. :ref:`bool<class_bool>` **enabled** = ``true``
  70. .. rst-class:: classref-property-setget
  71. - void **set_enabled** **(** :ref:`bool<class_bool>` value **)**
  72. - :ref:`bool<class_bool>` **is_enabled** **(** **)**
  73. Determines if the **NavigationMeshInstance** is enabled or disabled.
  74. .. rst-class:: classref-item-separator
  75. ----
  76. .. _class_NavigationMeshInstance_property_enter_cost:
  77. .. rst-class:: classref-property
  78. :ref:`float<class_float>` **enter_cost** = ``0.0``
  79. .. rst-class:: classref-property-setget
  80. - void **set_enter_cost** **(** :ref:`float<class_float>` value **)**
  81. - :ref:`float<class_float>` **get_enter_cost** **(** **)**
  82. 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.
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _class_NavigationMeshInstance_property_navigation_layers:
  86. .. rst-class:: classref-property
  87. :ref:`int<class_int>` **navigation_layers** = ``1``
  88. .. rst-class:: classref-property-setget
  89. - void **set_navigation_layers** **(** :ref:`int<class_int>` value **)**
  90. - :ref:`int<class_int>` **get_navigation_layers** **(** **)**
  91. A bitfield determining all navigation map layers the :ref:`NavigationMesh<class_NavigationMesh>` belongs to. On path requests with :ref:`NavigationServer.map_get_path<class_NavigationServer_method_map_get_path>` navmeshes without matching layers will be ignored and the navigation map will only proximity merge different navmeshes with matching layers.
  92. .. rst-class:: classref-item-separator
  93. ----
  94. .. _class_NavigationMeshInstance_property_navmesh:
  95. .. rst-class:: classref-property
  96. :ref:`NavigationMesh<class_NavigationMesh>` **navmesh**
  97. .. rst-class:: classref-property-setget
  98. - void **set_navigation_mesh** **(** :ref:`NavigationMesh<class_NavigationMesh>` value **)**
  99. - :ref:`NavigationMesh<class_NavigationMesh>` **get_navigation_mesh** **(** **)**
  100. The :ref:`NavigationMesh<class_NavigationMesh>` resource to use.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_NavigationMeshInstance_property_travel_cost:
  104. .. rst-class:: classref-property
  105. :ref:`float<class_float>` **travel_cost** = ``1.0``
  106. .. rst-class:: classref-property-setget
  107. - void **set_travel_cost** **(** :ref:`float<class_float>` value **)**
  108. - :ref:`float<class_float>` **get_travel_cost** **(** **)**
  109. When pathfinding moves inside this region's navmesh the traveled distances are multiplied with ``travel_cost`` for determining the shortest path.
  110. .. rst-class:: classref-section-separator
  111. ----
  112. .. rst-class:: classref-descriptions-group
  113. Method Descriptions
  114. -------------------
  115. .. _class_NavigationMeshInstance_method_bake_navigation_mesh:
  116. .. rst-class:: classref-method
  117. void **bake_navigation_mesh** **(** :ref:`bool<class_bool>` on_thread=true **)**
  118. Bakes the :ref:`NavigationMesh<class_NavigationMesh>`. If ``on_thread`` is set to ``true`` (default), the baking is done on a separate thread. Baking on separate thread is useful because navigation baking is not a cheap operation. When it is completed, it automatically sets the new :ref:`NavigationMesh<class_NavigationMesh>`. Please note that baking on separate thread may be very slow if geometry is parsed from meshes as async access to each mesh involves heavy synchronization. Also, please note that baking on a separate thread is automatically disabled on operating systems that cannot use threads (such as HTML5 with threads disabled).
  119. .. rst-class:: classref-item-separator
  120. ----
  121. .. _class_NavigationMeshInstance_method_get_region_rid:
  122. .. rst-class:: classref-method
  123. :ref:`RID<class_RID>` **get_region_rid** **(** **)** |const|
  124. Returns the :ref:`RID<class_RID>` of this region on the :ref:`NavigationServer<class_NavigationServer>`. Combined with :ref:`NavigationServer.map_get_closest_point_owner<class_NavigationServer_method_map_get_closest_point_owner>` can be used to identify the **NavigationMeshInstance** closest to a point on the merged navigation map.
  125. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  126. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  127. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  128. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`