class_pathfollow.rst 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/PathFollow.xml.
  6. .. _class_PathFollow:
  7. PathFollow
  8. ==========
  9. **Inherits:** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Point sampler for a :ref:`Path<class_Path>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This node takes its parent :ref:`Path<class_Path>`, 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 an offset 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_PathFollow_property_cubic_interp>` | ``true`` |
  23. +---------------------------------------------------+---------------------------------------------------------------+----------+
  24. | :ref:`float<class_float>` | :ref:`h_offset<class_PathFollow_property_h_offset>` | ``0.0`` |
  25. +---------------------------------------------------+---------------------------------------------------------------+----------+
  26. | :ref:`bool<class_bool>` | :ref:`loop<class_PathFollow_property_loop>` | ``true`` |
  27. +---------------------------------------------------+---------------------------------------------------------------+----------+
  28. | :ref:`float<class_float>` | :ref:`offset<class_PathFollow_property_offset>` | ``0.0`` |
  29. +---------------------------------------------------+---------------------------------------------------------------+----------+
  30. | :ref:`RotationMode<enum_PathFollow_RotationMode>` | :ref:`rotation_mode<class_PathFollow_property_rotation_mode>` | ``3`` |
  31. +---------------------------------------------------+---------------------------------------------------------------+----------+
  32. | :ref:`float<class_float>` | :ref:`unit_offset<class_PathFollow_property_unit_offset>` | ``0.0`` |
  33. +---------------------------------------------------+---------------------------------------------------------------+----------+
  34. | :ref:`float<class_float>` | :ref:`v_offset<class_PathFollow_property_v_offset>` | ``0.0`` |
  35. +---------------------------------------------------+---------------------------------------------------------------+----------+
  36. .. rst-class:: classref-section-separator
  37. ----
  38. .. rst-class:: classref-descriptions-group
  39. Enumerations
  40. ------------
  41. .. _enum_PathFollow_RotationMode:
  42. .. rst-class:: classref-enumeration
  43. enum **RotationMode**:
  44. .. _class_PathFollow_constant_ROTATION_NONE:
  45. .. rst-class:: classref-enumeration-constant
  46. :ref:`RotationMode<enum_PathFollow_RotationMode>` **ROTATION_NONE** = ``0``
  47. Forbids the PathFollow to rotate.
  48. .. _class_PathFollow_constant_ROTATION_Y:
  49. .. rst-class:: classref-enumeration-constant
  50. :ref:`RotationMode<enum_PathFollow_RotationMode>` **ROTATION_Y** = ``1``
  51. Allows the PathFollow to rotate in the Y axis only.
  52. .. _class_PathFollow_constant_ROTATION_XY:
  53. .. rst-class:: classref-enumeration-constant
  54. :ref:`RotationMode<enum_PathFollow_RotationMode>` **ROTATION_XY** = ``2``
  55. Allows the PathFollow to rotate in both the X, and Y axes.
  56. .. _class_PathFollow_constant_ROTATION_XYZ:
  57. .. rst-class:: classref-enumeration-constant
  58. :ref:`RotationMode<enum_PathFollow_RotationMode>` **ROTATION_XYZ** = ``3``
  59. Allows the PathFollow to rotate in any axis.
  60. .. _class_PathFollow_constant_ROTATION_ORIENTED:
  61. .. rst-class:: classref-enumeration-constant
  62. :ref:`RotationMode<enum_PathFollow_RotationMode>` **ROTATION_ORIENTED** = ``4``
  63. Uses the up vector information in a :ref:`Curve3D<class_Curve3D>` to enforce orientation. This rotation mode requires the :ref:`Path<class_Path>`'s :ref:`Curve3D.up_vector_enabled<class_Curve3D_property_up_vector_enabled>` property to be set to ``true``.
  64. .. rst-class:: classref-section-separator
  65. ----
  66. .. rst-class:: classref-descriptions-group
  67. Property Descriptions
  68. ---------------------
  69. .. _class_PathFollow_property_cubic_interp:
  70. .. rst-class:: classref-property
  71. :ref:`bool<class_bool>` **cubic_interp** = ``true``
  72. .. rst-class:: classref-property-setget
  73. - void **set_cubic_interpolation** **(** :ref:`bool<class_bool>` value **)**
  74. - :ref:`bool<class_bool>` **get_cubic_interpolation** **(** **)**
  75. If ``true``, the position between two cached points is interpolated cubically, and linearly otherwise.
  76. The points along the :ref:`Curve3D<class_Curve3D>` of the :ref:`Path<class_Path>` 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.
  77. 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.
  78. .. rst-class:: classref-item-separator
  79. ----
  80. .. _class_PathFollow_property_h_offset:
  81. .. rst-class:: classref-property
  82. :ref:`float<class_float>` **h_offset** = ``0.0``
  83. .. rst-class:: classref-property-setget
  84. - void **set_h_offset** **(** :ref:`float<class_float>` value **)**
  85. - :ref:`float<class_float>` **get_h_offset** **(** **)**
  86. The node's offset along the curve.
  87. .. rst-class:: classref-item-separator
  88. ----
  89. .. _class_PathFollow_property_loop:
  90. .. rst-class:: classref-property
  91. :ref:`bool<class_bool>` **loop** = ``true``
  92. .. rst-class:: classref-property-setget
  93. - void **set_loop** **(** :ref:`bool<class_bool>` value **)**
  94. - :ref:`bool<class_bool>` **has_loop** **(** **)**
  95. If ``true``, any offset outside the path's length will wrap around, instead of stopping at the ends. Use it for cyclic paths.
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_PathFollow_property_offset:
  99. .. rst-class:: classref-property
  100. :ref:`float<class_float>` **offset** = ``0.0``
  101. .. rst-class:: classref-property-setget
  102. - void **set_offset** **(** :ref:`float<class_float>` value **)**
  103. - :ref:`float<class_float>` **get_offset** **(** **)**
  104. The distance from the first vertex, measured in 3D units along the path. This sets this node's position to a point within the path.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_PathFollow_property_rotation_mode:
  108. .. rst-class:: classref-property
  109. :ref:`RotationMode<enum_PathFollow_RotationMode>` **rotation_mode** = ``3``
  110. .. rst-class:: classref-property-setget
  111. - void **set_rotation_mode** **(** :ref:`RotationMode<enum_PathFollow_RotationMode>` value **)**
  112. - :ref:`RotationMode<enum_PathFollow_RotationMode>` **get_rotation_mode** **(** **)**
  113. Allows or forbids rotation on one or more axes, depending on the :ref:`RotationMode<enum_PathFollow_RotationMode>` constants being used.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_PathFollow_property_unit_offset:
  117. .. rst-class:: classref-property
  118. :ref:`float<class_float>` **unit_offset** = ``0.0``
  119. .. rst-class:: classref-property-setget
  120. - void **set_unit_offset** **(** :ref:`float<class_float>` value **)**
  121. - :ref:`float<class_float>` **get_unit_offset** **(** **)**
  122. The distance from the first vertex, considering 0.0 as the first vertex and 1.0 as the last. This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_PathFollow_property_v_offset:
  126. .. rst-class:: classref-property
  127. :ref:`float<class_float>` **v_offset** = ``0.0``
  128. .. rst-class:: classref-property-setget
  129. - void **set_v_offset** **(** :ref:`float<class_float>` value **)**
  130. - :ref:`float<class_float>` **get_v_offset** **(** **)**
  131. The node's offset perpendicular to the curve.
  132. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  133. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  134. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  135. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`