class_navigationlink2d.rst 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/NavigationLink2D.xml.
  6. .. _class_NavigationLink2D:
  7. NavigationLink2D
  8. ================
  9. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Creates a link between two positions that :ref:`NavigationServer2D<class_NavigationServer2D>` can route agents through.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Creates a link between two positions that :ref:`NavigationServer2D<class_NavigationServer2D>` can route agents through. Links can be used to express navigation methods that aren't just traveling along the surface of the navigation mesh, like zip-lines, teleporters, or jumping across gaps.
  15. .. rst-class:: classref-introduction-group
  16. Tutorials
  17. ---------
  18. - :doc:`Using NavigationLinks <../tutorials/navigation/navigation_using_navigationlinks>`
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  25. | :ref:`bool<class_bool>` | :ref:`bidirectional<class_NavigationLink2D_property_bidirectional>` | ``true`` |
  26. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  27. | :ref:`bool<class_bool>` | :ref:`enabled<class_NavigationLink2D_property_enabled>` | ``true`` |
  28. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  29. | :ref:`Vector2<class_Vector2>` | :ref:`end_position<class_NavigationLink2D_property_end_position>` | ``Vector2(0, 0)`` |
  30. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  31. | :ref:`float<class_float>` | :ref:`enter_cost<class_NavigationLink2D_property_enter_cost>` | ``0.0`` |
  32. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  33. | :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationLink2D_property_navigation_layers>` | ``1`` |
  34. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  35. | :ref:`Vector2<class_Vector2>` | :ref:`start_position<class_NavigationLink2D_property_start_position>` | ``Vector2(0, 0)`` |
  36. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  37. | :ref:`float<class_float>` | :ref:`travel_cost<class_NavigationLink2D_property_travel_cost>` | ``1.0`` |
  38. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  39. .. rst-class:: classref-reftable-group
  40. Methods
  41. -------
  42. .. table::
  43. :widths: auto
  44. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`get_navigation_layer_value<class_NavigationLink2D_method_get_navigation_layer_value>` **(** :ref:`int<class_int>` layer_number **)** |const| |
  46. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`set_navigation_layer_value<class_NavigationLink2D_method_set_navigation_layer_value>` **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)** |
  48. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. .. rst-class:: classref-section-separator
  50. ----
  51. .. rst-class:: classref-descriptions-group
  52. Property Descriptions
  53. ---------------------
  54. .. _class_NavigationLink2D_property_bidirectional:
  55. .. rst-class:: classref-property
  56. :ref:`bool<class_bool>` **bidirectional** = ``true``
  57. .. rst-class:: classref-property-setget
  58. - void **set_bidirectional** **(** :ref:`bool<class_bool>` value **)**
  59. - :ref:`bool<class_bool>` **is_bidirectional** **(** **)**
  60. Whether this link can be traveled in both directions or only from :ref:`start_position<class_NavigationLink2D_property_start_position>` to :ref:`end_position<class_NavigationLink2D_property_end_position>`.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_NavigationLink2D_property_enabled:
  64. .. rst-class:: classref-property
  65. :ref:`bool<class_bool>` **enabled** = ``true``
  66. .. rst-class:: classref-property-setget
  67. - void **set_enabled** **(** :ref:`bool<class_bool>` value **)**
  68. - :ref:`bool<class_bool>` **is_enabled** **(** **)**
  69. Whether this link is currently active. If ``false``, :ref:`NavigationServer2D.map_get_path<class_NavigationServer2D_method_map_get_path>` will ignore this link.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_NavigationLink2D_property_end_position:
  73. .. rst-class:: classref-property
  74. :ref:`Vector2<class_Vector2>` **end_position** = ``Vector2(0, 0)``
  75. .. rst-class:: classref-property-setget
  76. - void **set_end_position** **(** :ref:`Vector2<class_Vector2>` value **)**
  77. - :ref:`Vector2<class_Vector2>` **get_end_position** **(** **)**
  78. Ending position of the link.
  79. This position will search out the nearest polygon in the navigation mesh to attach to.
  80. The distance the link will search is controlled by :ref:`NavigationServer2D.map_set_link_connection_radius<class_NavigationServer2D_method_map_set_link_connection_radius>`.
  81. .. rst-class:: classref-item-separator
  82. ----
  83. .. _class_NavigationLink2D_property_enter_cost:
  84. .. rst-class:: classref-property
  85. :ref:`float<class_float>` **enter_cost** = ``0.0``
  86. .. rst-class:: classref-property-setget
  87. - void **set_enter_cost** **(** :ref:`float<class_float>` value **)**
  88. - :ref:`float<class_float>` **get_enter_cost** **(** **)**
  89. When pathfinding enters this link from another regions navigation mesh the ``enter_cost`` value is added to the path distance for determining the shortest path.
  90. .. rst-class:: classref-item-separator
  91. ----
  92. .. _class_NavigationLink2D_property_navigation_layers:
  93. .. rst-class:: classref-property
  94. :ref:`int<class_int>` **navigation_layers** = ``1``
  95. .. rst-class:: classref-property-setget
  96. - void **set_navigation_layers** **(** :ref:`int<class_int>` value **)**
  97. - :ref:`int<class_int>` **get_navigation_layers** **(** **)**
  98. A bitfield determining all navigation layers the link belongs to. These navigation layers will be checked when requesting a path with :ref:`NavigationServer2D.map_get_path<class_NavigationServer2D_method_map_get_path>`.
  99. .. rst-class:: classref-item-separator
  100. ----
  101. .. _class_NavigationLink2D_property_start_position:
  102. .. rst-class:: classref-property
  103. :ref:`Vector2<class_Vector2>` **start_position** = ``Vector2(0, 0)``
  104. .. rst-class:: classref-property-setget
  105. - void **set_start_position** **(** :ref:`Vector2<class_Vector2>` value **)**
  106. - :ref:`Vector2<class_Vector2>` **get_start_position** **(** **)**
  107. Starting position of the link.
  108. This position will search out the nearest polygon in the navigation mesh to attach to.
  109. The distance the link will search is controlled by :ref:`NavigationServer2D.map_set_link_connection_radius<class_NavigationServer2D_method_map_set_link_connection_radius>`.
  110. .. rst-class:: classref-item-separator
  111. ----
  112. .. _class_NavigationLink2D_property_travel_cost:
  113. .. rst-class:: classref-property
  114. :ref:`float<class_float>` **travel_cost** = ``1.0``
  115. .. rst-class:: classref-property-setget
  116. - void **set_travel_cost** **(** :ref:`float<class_float>` value **)**
  117. - :ref:`float<class_float>` **get_travel_cost** **(** **)**
  118. When pathfinding moves along the link the traveled distance is multiplied with ``travel_cost`` for determining the shortest path.
  119. .. rst-class:: classref-section-separator
  120. ----
  121. .. rst-class:: classref-descriptions-group
  122. Method Descriptions
  123. -------------------
  124. .. _class_NavigationLink2D_method_get_navigation_layer_value:
  125. .. rst-class:: classref-method
  126. :ref:`bool<class_bool>` **get_navigation_layer_value** **(** :ref:`int<class_int>` layer_number **)** |const|
  127. Returns whether or not the specified layer of the :ref:`navigation_layers<class_NavigationLink2D_property_navigation_layers>` bitmask is enabled, given a ``layer_number`` between 1 and 32.
  128. .. rst-class:: classref-item-separator
  129. ----
  130. .. _class_NavigationLink2D_method_set_navigation_layer_value:
  131. .. rst-class:: classref-method
  132. void **set_navigation_layer_value** **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)**
  133. Based on ``value``, enables or disables the specified layer in the :ref:`navigation_layers<class_NavigationLink2D_property_navigation_layers>` bitmask, given a ``layer_number`` between 1 and 32.
  134. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  135. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  136. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  137. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  138. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  139. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`