class_pathfollow2d.rst 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/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:`bool<class_bool>` | :ref:`loop<class_PathFollow2D_property_loop>` | ``true`` |
  27. +---------------------------+-------------------------------------------------------------------+----------+
  28. | :ref:`float<class_float>` | :ref:`progress<class_PathFollow2D_property_progress>` | ``0.0`` |
  29. +---------------------------+-------------------------------------------------------------------+----------+
  30. | :ref:`float<class_float>` | :ref:`progress_ratio<class_PathFollow2D_property_progress_ratio>` | ``0.0`` |
  31. +---------------------------+-------------------------------------------------------------------+----------+
  32. | :ref:`bool<class_bool>` | :ref:`rotates<class_PathFollow2D_property_rotates>` | ``true`` |
  33. +---------------------------+-------------------------------------------------------------------+----------+
  34. | :ref:`float<class_float>` | :ref:`v_offset<class_PathFollow2D_property_v_offset>` | ``0.0`` |
  35. +---------------------------+-------------------------------------------------------------------+----------+
  36. .. rst-class:: classref-section-separator
  37. ----
  38. .. rst-class:: classref-descriptions-group
  39. Property Descriptions
  40. ---------------------
  41. .. _class_PathFollow2D_property_cubic_interp:
  42. .. rst-class:: classref-property
  43. :ref:`bool<class_bool>` **cubic_interp** = ``true``
  44. .. rst-class:: classref-property-setget
  45. - void **set_cubic_interpolation** **(** :ref:`bool<class_bool>` value **)**
  46. - :ref:`bool<class_bool>` **get_cubic_interpolation** **(** **)**
  47. If ``true``, the position between two cached points is interpolated cubically, and linearly otherwise.
  48. 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.
  49. 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.
  50. .. rst-class:: classref-item-separator
  51. ----
  52. .. _class_PathFollow2D_property_h_offset:
  53. .. rst-class:: classref-property
  54. :ref:`float<class_float>` **h_offset** = ``0.0``
  55. .. rst-class:: classref-property-setget
  56. - void **set_h_offset** **(** :ref:`float<class_float>` value **)**
  57. - :ref:`float<class_float>` **get_h_offset** **(** **)**
  58. The node's offset along the curve.
  59. .. rst-class:: classref-item-separator
  60. ----
  61. .. _class_PathFollow2D_property_loop:
  62. .. rst-class:: classref-property
  63. :ref:`bool<class_bool>` **loop** = ``true``
  64. .. rst-class:: classref-property-setget
  65. - void **set_loop** **(** :ref:`bool<class_bool>` value **)**
  66. - :ref:`bool<class_bool>` **has_loop** **(** **)**
  67. If ``true``, any offset outside the path's length will wrap around, instead of stopping at the ends. Use it for cyclic paths.
  68. .. rst-class:: classref-item-separator
  69. ----
  70. .. _class_PathFollow2D_property_progress:
  71. .. rst-class:: classref-property
  72. :ref:`float<class_float>` **progress** = ``0.0``
  73. .. rst-class:: classref-property-setget
  74. - void **set_progress** **(** :ref:`float<class_float>` value **)**
  75. - :ref:`float<class_float>` **get_progress** **(** **)**
  76. The distance along the path, in pixels. Changing this value sets this node's position to a point within the path.
  77. .. rst-class:: classref-item-separator
  78. ----
  79. .. _class_PathFollow2D_property_progress_ratio:
  80. .. rst-class:: classref-property
  81. :ref:`float<class_float>` **progress_ratio** = ``0.0``
  82. .. rst-class:: classref-property-setget
  83. - void **set_progress_ratio** **(** :ref:`float<class_float>` value **)**
  84. - :ref:`float<class_float>` **get_progress_ratio** **(** **)**
  85. 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.
  86. .. rst-class:: classref-item-separator
  87. ----
  88. .. _class_PathFollow2D_property_rotates:
  89. .. rst-class:: classref-property
  90. :ref:`bool<class_bool>` **rotates** = ``true``
  91. .. rst-class:: classref-property-setget
  92. - void **set_rotates** **(** :ref:`bool<class_bool>` value **)**
  93. - :ref:`bool<class_bool>` **is_rotating** **(** **)**
  94. If ``true``, this node rotates to follow the path, with the +X direction facing forward on the path.
  95. .. rst-class:: classref-item-separator
  96. ----
  97. .. _class_PathFollow2D_property_v_offset:
  98. .. rst-class:: classref-property
  99. :ref:`float<class_float>` **v_offset** = ``0.0``
  100. .. rst-class:: classref-property-setget
  101. - void **set_v_offset** **(** :ref:`float<class_float>` value **)**
  102. - :ref:`float<class_float>` **get_v_offset** **(** **)**
  103. The node's offset perpendicular to the curve.
  104. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  105. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  106. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  107. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  108. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  109. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  110. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`