123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/PathFollow2D.xml.
- .. _class_PathFollow2D:
- PathFollow2D
- ============
- **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- Point sampler for a :ref:`Path2D<class_Path2D>`.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- 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.
- 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.
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +---------------------------+-------------------------------------------------------------------+----------+
- | :ref:`bool<class_bool>` | :ref:`cubic_interp<class_PathFollow2D_property_cubic_interp>` | ``true`` |
- +---------------------------+-------------------------------------------------------------------+----------+
- | :ref:`float<class_float>` | :ref:`h_offset<class_PathFollow2D_property_h_offset>` | ``0.0`` |
- +---------------------------+-------------------------------------------------------------------+----------+
- | :ref:`bool<class_bool>` | :ref:`loop<class_PathFollow2D_property_loop>` | ``true`` |
- +---------------------------+-------------------------------------------------------------------+----------+
- | :ref:`float<class_float>` | :ref:`progress<class_PathFollow2D_property_progress>` | ``0.0`` |
- +---------------------------+-------------------------------------------------------------------+----------+
- | :ref:`float<class_float>` | :ref:`progress_ratio<class_PathFollow2D_property_progress_ratio>` | ``0.0`` |
- +---------------------------+-------------------------------------------------------------------+----------+
- | :ref:`bool<class_bool>` | :ref:`rotates<class_PathFollow2D_property_rotates>` | ``true`` |
- +---------------------------+-------------------------------------------------------------------+----------+
- | :ref:`float<class_float>` | :ref:`v_offset<class_PathFollow2D_property_v_offset>` | ``0.0`` |
- +---------------------------+-------------------------------------------------------------------+----------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_PathFollow2D_property_cubic_interp:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **cubic_interp** = ``true`` :ref:`🔗<class_PathFollow2D_property_cubic_interp>`
- .. rst-class:: classref-property-setget
- - |void| **set_cubic_interpolation**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **get_cubic_interpolation**\ (\ )
- If ``true``, the position between two cached points is interpolated cubically, and linearly otherwise.
- 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.
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PathFollow2D_property_h_offset:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **h_offset** = ``0.0`` :ref:`🔗<class_PathFollow2D_property_h_offset>`
- .. rst-class:: classref-property-setget
- - |void| **set_h_offset**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_h_offset**\ (\ )
- The node's offset along the curve.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PathFollow2D_property_loop:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **loop** = ``true`` :ref:`🔗<class_PathFollow2D_property_loop>`
- .. rst-class:: classref-property-setget
- - |void| **set_loop**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **has_loop**\ (\ )
- If ``true``, any offset outside the path's length will wrap around, instead of stopping at the ends. Use it for cyclic paths.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PathFollow2D_property_progress:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **progress** = ``0.0`` :ref:`🔗<class_PathFollow2D_property_progress>`
- .. rst-class:: classref-property-setget
- - |void| **set_progress**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_progress**\ (\ )
- The distance along the path, in pixels. Changing this value sets this node's position to a point within the path.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PathFollow2D_property_progress_ratio:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **progress_ratio** = ``0.0`` :ref:`🔗<class_PathFollow2D_property_progress_ratio>`
- .. rst-class:: classref-property-setget
- - |void| **set_progress_ratio**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_progress_ratio**\ (\ )
- 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.
- 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``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PathFollow2D_property_rotates:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **rotates** = ``true`` :ref:`🔗<class_PathFollow2D_property_rotates>`
- .. rst-class:: classref-property-setget
- - |void| **set_rotates**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_rotating**\ (\ )
- If ``true``, this node rotates to follow the path, with the +X direction facing forward on the path.
- .. rst-class:: classref-item-separator
- ----
- .. _class_PathFollow2D_property_v_offset:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **v_offset** = ``0.0`` :ref:`🔗<class_PathFollow2D_property_v_offset>`
- .. rst-class:: classref-property-setget
- - |void| **set_v_offset**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_v_offset**\ (\ )
- The node's offset perpendicular to the curve.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|