class_pathfollow2d.rst 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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/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`` :ref:`🔗<class_PathFollow2D_property_cubic_interp>`
  44. .. rst-class:: classref-property-setget
  45. - |void| **set_cubic_interpolation**\ (\ value\: :ref:`bool<class_bool>`\ )
  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`` :ref:`🔗<class_PathFollow2D_property_h_offset>`
  55. .. rst-class:: classref-property-setget
  56. - |void| **set_h_offset**\ (\ value\: :ref:`float<class_float>`\ )
  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`` :ref:`🔗<class_PathFollow2D_property_loop>`
  64. .. rst-class:: classref-property-setget
  65. - |void| **set_loop**\ (\ value\: :ref:`bool<class_bool>`\ )
  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`` :ref:`🔗<class_PathFollow2D_property_progress>`
  73. .. rst-class:: classref-property-setget
  74. - |void| **set_progress**\ (\ value\: :ref:`float<class_float>`\ )
  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`` :ref:`🔗<class_PathFollow2D_property_progress_ratio>`
  82. .. rst-class:: classref-property-setget
  83. - |void| **set_progress_ratio**\ (\ value\: :ref:`float<class_float>`\ )
  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. It can be set or get only if the **PathFollow2D** is the child of a :ref:`Path2D<class_Path2D>` which is part of the scene tree, and that this :ref:`Path2D<class_Path2D>` has a :ref:`Curve2D<class_Curve2D>` with a non-zero length. Otherwise, trying to set this field will print an error, and getting this field will return ``0.0``.
  87. .. rst-class:: classref-item-separator
  88. ----
  89. .. _class_PathFollow2D_property_rotates:
  90. .. rst-class:: classref-property
  91. :ref:`bool<class_bool>` **rotates** = ``true`` :ref:`🔗<class_PathFollow2D_property_rotates>`
  92. .. rst-class:: classref-property-setget
  93. - |void| **set_rotates**\ (\ value\: :ref:`bool<class_bool>`\ )
  94. - :ref:`bool<class_bool>` **is_rotating**\ (\ )
  95. If ``true``, this node rotates to follow the path, with the +X direction facing forward on the path.
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_PathFollow2D_property_v_offset:
  99. .. rst-class:: classref-property
  100. :ref:`float<class_float>` **v_offset** = ``0.0`` :ref:`🔗<class_PathFollow2D_property_v_offset>`
  101. .. rst-class:: classref-property-setget
  102. - |void| **set_v_offset**\ (\ value\: :ref:`float<class_float>`\ )
  103. - :ref:`float<class_float>` **get_v_offset**\ (\ )
  104. The node's offset perpendicular to the curve.
  105. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  106. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  107. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  108. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  109. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  110. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  111. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  112. .. |void| replace:: :abbr:`void (No return value.)`