class_navigationlink2d.rst 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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 locations that :ref:`NavigationServer2D<class_NavigationServer2D>` can route agents through.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Creates a link between two locations 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-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  21. | :ref:`bool<class_bool>` | :ref:`bidirectional<class_NavigationLink2D_property_bidirectional>` | ``true`` |
  22. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  23. | :ref:`bool<class_bool>` | :ref:`enabled<class_NavigationLink2D_property_enabled>` | ``true`` |
  24. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  25. | :ref:`Vector2<class_Vector2>` | :ref:`end_location<class_NavigationLink2D_property_end_location>` | ``Vector2(0, 0)`` |
  26. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  27. | :ref:`float<class_float>` | :ref:`enter_cost<class_NavigationLink2D_property_enter_cost>` | ``0.0`` |
  28. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  29. | :ref:`int<class_int>` | :ref:`navigation_layers<class_NavigationLink2D_property_navigation_layers>` | ``1`` |
  30. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  31. | :ref:`Vector2<class_Vector2>` | :ref:`start_location<class_NavigationLink2D_property_start_location>` | ``Vector2(0, 0)`` |
  32. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  33. | :ref:`float<class_float>` | :ref:`travel_cost<class_NavigationLink2D_property_travel_cost>` | ``1.0`` |
  34. +-------------------------------+-----------------------------------------------------------------------------+-------------------+
  35. .. rst-class:: classref-reftable-group
  36. Methods
  37. -------
  38. .. table::
  39. :widths: auto
  40. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`get_navigation_layer_value<class_NavigationLink2D_method_get_navigation_layer_value>` **(** :ref:`int<class_int>` layer_number **)** |const| |
  42. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_navigation_layer_value<class_NavigationLink2D_method_set_navigation_layer_value>` **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)** |
  44. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. .. rst-class:: classref-section-separator
  46. ----
  47. .. rst-class:: classref-descriptions-group
  48. Property Descriptions
  49. ---------------------
  50. .. _class_NavigationLink2D_property_bidirectional:
  51. .. rst-class:: classref-property
  52. :ref:`bool<class_bool>` **bidirectional** = ``true``
  53. .. rst-class:: classref-property-setget
  54. - void **set_bidirectional** **(** :ref:`bool<class_bool>` value **)**
  55. - :ref:`bool<class_bool>` **is_bidirectional** **(** **)**
  56. Whether this link can be traveled in both directions or only from :ref:`start_location<class_NavigationLink2D_property_start_location>` to :ref:`end_location<class_NavigationLink2D_property_end_location>`.
  57. .. rst-class:: classref-item-separator
  58. ----
  59. .. _class_NavigationLink2D_property_enabled:
  60. .. rst-class:: classref-property
  61. :ref:`bool<class_bool>` **enabled** = ``true``
  62. .. rst-class:: classref-property-setget
  63. - void **set_enabled** **(** :ref:`bool<class_bool>` value **)**
  64. - :ref:`bool<class_bool>` **is_enabled** **(** **)**
  65. Whether this link is currently active. If ``false``, :ref:`NavigationServer2D.map_get_path<class_NavigationServer2D_method_map_get_path>` will ignore this link.
  66. .. rst-class:: classref-item-separator
  67. ----
  68. .. _class_NavigationLink2D_property_end_location:
  69. .. rst-class:: classref-property
  70. :ref:`Vector2<class_Vector2>` **end_location** = ``Vector2(0, 0)``
  71. .. rst-class:: classref-property-setget
  72. - void **set_end_location** **(** :ref:`Vector2<class_Vector2>` value **)**
  73. - :ref:`Vector2<class_Vector2>` **get_end_location** **(** **)**
  74. Ending position of the link.
  75. This position will search out the nearest polygon in the navigation mesh to attach to.
  76. The distance the link will search is controlled by :ref:`NavigationServer2D.map_set_link_connection_radius<class_NavigationServer2D_method_map_set_link_connection_radius>`.
  77. .. rst-class:: classref-item-separator
  78. ----
  79. .. _class_NavigationLink2D_property_enter_cost:
  80. .. rst-class:: classref-property
  81. :ref:`float<class_float>` **enter_cost** = ``0.0``
  82. .. rst-class:: classref-property-setget
  83. - void **set_enter_cost** **(** :ref:`float<class_float>` value **)**
  84. - :ref:`float<class_float>` **get_enter_cost** **(** **)**
  85. 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.
  86. .. rst-class:: classref-item-separator
  87. ----
  88. .. _class_NavigationLink2D_property_navigation_layers:
  89. .. rst-class:: classref-property
  90. :ref:`int<class_int>` **navigation_layers** = ``1``
  91. .. rst-class:: classref-property-setget
  92. - void **set_navigation_layers** **(** :ref:`int<class_int>` value **)**
  93. - :ref:`int<class_int>` **get_navigation_layers** **(** **)**
  94. 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>`.
  95. .. rst-class:: classref-item-separator
  96. ----
  97. .. _class_NavigationLink2D_property_start_location:
  98. .. rst-class:: classref-property
  99. :ref:`Vector2<class_Vector2>` **start_location** = ``Vector2(0, 0)``
  100. .. rst-class:: classref-property-setget
  101. - void **set_start_location** **(** :ref:`Vector2<class_Vector2>` value **)**
  102. - :ref:`Vector2<class_Vector2>` **get_start_location** **(** **)**
  103. Starting position of the link.
  104. This position will search out the nearest polygon in the navigation mesh to attach to.
  105. The distance the link will search is controlled by :ref:`NavigationServer2D.map_set_link_connection_radius<class_NavigationServer2D_method_map_set_link_connection_radius>`.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_NavigationLink2D_property_travel_cost:
  109. .. rst-class:: classref-property
  110. :ref:`float<class_float>` **travel_cost** = ``1.0``
  111. .. rst-class:: classref-property-setget
  112. - void **set_travel_cost** **(** :ref:`float<class_float>` value **)**
  113. - :ref:`float<class_float>` **get_travel_cost** **(** **)**
  114. When pathfinding moves along the link the traveled distance is multiplied with ``travel_cost`` for determining the shortest path.
  115. .. rst-class:: classref-section-separator
  116. ----
  117. .. rst-class:: classref-descriptions-group
  118. Method Descriptions
  119. -------------------
  120. .. _class_NavigationLink2D_method_get_navigation_layer_value:
  121. .. rst-class:: classref-method
  122. :ref:`bool<class_bool>` **get_navigation_layer_value** **(** :ref:`int<class_int>` layer_number **)** |const|
  123. 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.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_NavigationLink2D_method_set_navigation_layer_value:
  127. .. rst-class:: classref-method
  128. void **set_navigation_layer_value** **(** :ref:`int<class_int>` layer_number, :ref:`bool<class_bool>` value **)**
  129. 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.
  130. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  131. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  132. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  133. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  134. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  135. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`