class_pathfollow2d.rst 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/PathFollow2D.xml.
  6. .. _class_PathFollow2D:
  7. PathFollow2D
  8. ============
  9. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Point sampler for a :ref:`Path2D<class_Path2D>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This node takes its parent :ref:`Path2D<class_Path2D>`, and returns the coordinates of a point within it, given a distance from the first vertex.
  15. It is useful for making other nodes follow a path, without coding the movement pattern. For that, the nodes must be children of this node. The descendant nodes will then move accordingly when setting the :ref:`progress<class_PathFollow2D_property_progress>` in this node.
  16. .. rst-class:: classref-reftable-group
  17. Properties
  18. ----------
  19. .. table::
  20. :widths: auto
  21. +---------------------------+-------------------------------------------------------------------+----------+
  22. | :ref:`bool<class_bool>` | :ref:`cubic_interp<class_PathFollow2D_property_cubic_interp>` | ``true`` |
  23. +---------------------------+-------------------------------------------------------------------+----------+
  24. | :ref:`float<class_float>` | :ref:`h_offset<class_PathFollow2D_property_h_offset>` | ``0.0`` |
  25. +---------------------------+-------------------------------------------------------------------+----------+
  26. | :ref:`float<class_float>` | :ref:`lookahead<class_PathFollow2D_property_lookahead>` | ``4.0`` |
  27. +---------------------------+-------------------------------------------------------------------+----------+
  28. | :ref:`bool<class_bool>` | :ref:`loop<class_PathFollow2D_property_loop>` | ``true`` |
  29. +---------------------------+-------------------------------------------------------------------+----------+
  30. | :ref:`float<class_float>` | :ref:`progress<class_PathFollow2D_property_progress>` | ``0.0`` |
  31. +---------------------------+-------------------------------------------------------------------+----------+
  32. | :ref:`float<class_float>` | :ref:`progress_ratio<class_PathFollow2D_property_progress_ratio>` | ``0.0`` |
  33. +---------------------------+-------------------------------------------------------------------+----------+
  34. | :ref:`bool<class_bool>` | :ref:`rotates<class_PathFollow2D_property_rotates>` | ``true`` |
  35. +---------------------------+-------------------------------------------------------------------+----------+
  36. | :ref:`float<class_float>` | :ref:`v_offset<class_PathFollow2D_property_v_offset>` | ``0.0`` |
  37. +---------------------------+-------------------------------------------------------------------+----------+
  38. .. rst-class:: classref-section-separator
  39. ----
  40. .. rst-class:: classref-descriptions-group
  41. Property Descriptions
  42. ---------------------
  43. .. _class_PathFollow2D_property_cubic_interp:
  44. .. rst-class:: classref-property
  45. :ref:`bool<class_bool>` **cubic_interp** = ``true``
  46. .. rst-class:: classref-property-setget
  47. - void **set_cubic_interpolation** **(** :ref:`bool<class_bool>` value **)**
  48. - :ref:`bool<class_bool>` **get_cubic_interpolation** **(** **)**
  49. If ``true``, the position between two cached points is interpolated cubically, and linearly otherwise.
  50. The points along the :ref:`Curve2D<class_Curve2D>` of the :ref:`Path2D<class_Path2D>` are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough.
  51. There are two answers to this problem: either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations.
  52. .. rst-class:: classref-item-separator
  53. ----
  54. .. _class_PathFollow2D_property_h_offset:
  55. .. rst-class:: classref-property
  56. :ref:`float<class_float>` **h_offset** = ``0.0``
  57. .. rst-class:: classref-property-setget
  58. - void **set_h_offset** **(** :ref:`float<class_float>` value **)**
  59. - :ref:`float<class_float>` **get_h_offset** **(** **)**
  60. The node's offset along the curve.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_PathFollow2D_property_lookahead:
  64. .. rst-class:: classref-property
  65. :ref:`float<class_float>` **lookahead** = ``4.0``
  66. .. rst-class:: classref-property-setget
  67. - void **set_lookahead** **(** :ref:`float<class_float>` value **)**
  68. - :ref:`float<class_float>` **get_lookahead** **(** **)**
  69. How far to look ahead of the curve to calculate the tangent if the node is rotating. E.g. shorter lookaheads will lead to faster rotations.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_PathFollow2D_property_loop:
  73. .. rst-class:: classref-property
  74. :ref:`bool<class_bool>` **loop** = ``true``
  75. .. rst-class:: classref-property-setget
  76. - void **set_loop** **(** :ref:`bool<class_bool>` value **)**
  77. - :ref:`bool<class_bool>` **has_loop** **(** **)**
  78. If ``true``, any offset outside the path's length will wrap around, instead of stopping at the ends. Use it for cyclic paths.
  79. .. rst-class:: classref-item-separator
  80. ----
  81. .. _class_PathFollow2D_property_progress:
  82. .. rst-class:: classref-property
  83. :ref:`float<class_float>` **progress** = ``0.0``
  84. .. rst-class:: classref-property-setget
  85. - void **set_progress** **(** :ref:`float<class_float>` value **)**
  86. - :ref:`float<class_float>` **get_progress** **(** **)**
  87. The distance along the path, in pixels. Changing this value sets this node's position to a point within the path.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_PathFollow2D_property_progress_ratio:
  91. .. rst-class:: classref-property
  92. :ref:`float<class_float>` **progress_ratio** = ``0.0``
  93. .. rst-class:: classref-property-setget
  94. - void **set_progress_ratio** **(** :ref:`float<class_float>` value **)**
  95. - :ref:`float<class_float>` **get_progress_ratio** **(** **)**
  96. The distance along the path as a number in the range 0.0 (for the first vertex) to 1.0 (for the last). This is just another way of expressing the progress within the path, as the offset supplied is multiplied internally by the path's length.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_PathFollow2D_property_rotates:
  100. .. rst-class:: classref-property
  101. :ref:`bool<class_bool>` **rotates** = ``true``
  102. .. rst-class:: classref-property-setget
  103. - void **set_rotates** **(** :ref:`bool<class_bool>` value **)**
  104. - :ref:`bool<class_bool>` **is_rotating** **(** **)**
  105. If ``true``, this node rotates to follow the path, with the +X direction facing forward on the path.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_PathFollow2D_property_v_offset:
  109. .. rst-class:: classref-property
  110. :ref:`float<class_float>` **v_offset** = ``0.0``
  111. .. rst-class:: classref-property-setget
  112. - void **set_v_offset** **(** :ref:`float<class_float>` value **)**
  113. - :ref:`float<class_float>` **get_v_offset** **(** **)**
  114. The node's offset perpendicular to the curve.
  115. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  116. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  117. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  118. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  119. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  120. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`