Files
godot-docs-l10n/classes/zh_Hant/class_pathfollow3d.rst

306 lines
13 KiB
ReStructuredText

:github_url: hide
.. _class_PathFollow3D:
PathFollow3D
============
**繼承:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
:ref:`Path3D<class_Path3D>` 的點取樣器。
.. rst-class:: classref-introduction-group
說明
----
這個節點接受它的父節點 :ref:`Path3D<class_Path3D>` 並返回其中一個點的座標,需要給定到第一個頂點的距離。
在不編碼移動圖案的情況下,它可以使其他節點遵循一條路徑。為此,節點必須是該節點的子節點。在該節點中設定 :ref:`progress<class_PathFollow3D_property_progress>` 後,後代節點會隨之移動。
.. rst-class:: classref-reftable-group
屬性
----
.. table::
:widths: auto
+-----------------------------------------------------+---------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`cubic_interp<class_PathFollow3D_property_cubic_interp>` | ``true`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`h_offset<class_PathFollow3D_property_h_offset>` | ``0.0`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`loop<class_PathFollow3D_property_loop>` | ``true`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`progress<class_PathFollow3D_property_progress>` | ``0.0`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`progress_ratio<class_PathFollow3D_property_progress_ratio>` | ``0.0`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-----------+
| :ref:`RotationMode<enum_PathFollow3D_RotationMode>` | :ref:`rotation_mode<class_PathFollow3D_property_rotation_mode>` | ``3`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`tilt_enabled<class_PathFollow3D_property_tilt_enabled>` | ``true`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`use_model_front<class_PathFollow3D_property_use_model_front>` | ``false`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`v_offset<class_PathFollow3D_property_v_offset>` | ``0.0`` |
+-----------------------------------------------------+---------------------------------------------------------------------+-----------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Transform3D<class_Transform3D>` | :ref:`correct_posture<class_PathFollow3D_method_correct_posture>`\ (\ transform\: :ref:`Transform3D<class_Transform3D>`, rotation_mode\: :ref:`RotationMode<enum_PathFollow3D_RotationMode>`\ ) |static| |
+---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
列舉
----
.. _enum_PathFollow3D_RotationMode:
.. rst-class:: classref-enumeration
enum **RotationMode**: :ref:`🔗<enum_PathFollow3D_RotationMode>`
.. _class_PathFollow3D_constant_ROTATION_NONE:
.. rst-class:: classref-enumeration-constant
:ref:`RotationMode<enum_PathFollow3D_RotationMode>` **ROTATION_NONE** = ``0``
禁止該 PathFollow3D 旋轉。
.. _class_PathFollow3D_constant_ROTATION_Y:
.. rst-class:: classref-enumeration-constant
:ref:`RotationMode<enum_PathFollow3D_RotationMode>` **ROTATION_Y** = ``1``
允許該 PathFollow3D 僅在 Y 軸上旋轉。
.. _class_PathFollow3D_constant_ROTATION_XY:
.. rst-class:: classref-enumeration-constant
:ref:`RotationMode<enum_PathFollow3D_RotationMode>` **ROTATION_XY** = ``2``
允許該 PathFollow3D 同時在 X 和 Y 軸上旋轉。
.. _class_PathFollow3D_constant_ROTATION_XYZ:
.. rst-class:: classref-enumeration-constant
:ref:`RotationMode<enum_PathFollow3D_RotationMode>` **ROTATION_XYZ** = ``3``
允許該 PathFollow3D 在任意軸上旋轉。
.. _class_PathFollow3D_constant_ROTATION_ORIENTED:
.. rst-class:: classref-enumeration-constant
:ref:`RotationMode<enum_PathFollow3D_RotationMode>` **ROTATION_ORIENTED** = ``4``
使用 :ref:`Curve3D<class_Curve3D>` 中的向上向量資訊來強制定向。該旋轉模式需要將 :ref:`Path3D<class_Path3D>`:ref:`Curve3D.up_vector_enabled<class_Curve3D_property_up_vector_enabled>` 屬性設定為 ``true``\ 。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
屬性說明
--------
.. _class_PathFollow3D_property_cubic_interp:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **cubic_interp** = ``true`` :ref:`🔗<class_PathFollow3D_property_cubic_interp>`
.. rst-class:: classref-property-setget
- |void| **set_cubic_interpolation**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **get_cubic_interpolation**\ (\ )
如果為 ``true``\ ,則兩個快取點之間的位置將被三次插值,否則將被線性插值。
沿著 :ref:`Path3D<class_Path3D>` 的 :ref:`Curve3D<class_Curve3D>` 的點在使用前已被預先計算,以便更快地計算。然後在兩個相鄰快取點之間,插值計算請求的偏移處的點。如果曲線急轉彎,這可能會出現問題,因為快取的點可能沒有足夠緊密地跟隨曲線。
這個問題有兩個答案:要麼增加快取點的數量,並增加記憶體消耗;要麼在兩個點之間進行三次插值,代價是(稍微)降低計算速度。
.. rst-class:: classref-item-separator
----
.. _class_PathFollow3D_property_h_offset:
.. rst-class:: classref-property
:ref:`float<class_float>` **h_offset** = ``0.0`` :ref:`🔗<class_PathFollow3D_property_h_offset>`
.. rst-class:: classref-property-setget
- |void| **set_h_offset**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_h_offset**\ (\ )
節點沿曲線的偏移量。
.. rst-class:: classref-item-separator
----
.. _class_PathFollow3D_property_loop:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **loop** = ``true`` :ref:`🔗<class_PathFollow3D_property_loop>`
.. rst-class:: classref-property-setget
- |void| **set_loop**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **has_loop**\ (\ )
如果為 ``true``\ ,路徑長度以外的任何偏移都將環繞,而不是在結束時停止。對於迴圈路徑使用它。
.. rst-class:: classref-item-separator
----
.. _class_PathFollow3D_property_progress:
.. rst-class:: classref-property
:ref:`float<class_float>` **progress** = ``0.0`` :ref:`🔗<class_PathFollow3D_property_progress>`
.. rst-class:: classref-property-setget
- |void| **set_progress**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_progress**\ (\ )
到第一個頂點的距離,單位為沿路徑經過的 3D 單位數。改變這個值會將這個節點的位置設定為路徑上的某個點。
.. rst-class:: classref-item-separator
----
.. _class_PathFollow3D_property_progress_ratio:
.. rst-class:: classref-property
:ref:`float<class_float>` **progress_ratio** = ``0.0`` :ref:`🔗<class_PathFollow3D_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 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 progress within the path, as the progress supplied is multiplied internally by the path's length.
It can be set or get only if the **PathFollow3D** is the child of a :ref:`Path3D<class_Path3D>` which is part of the scene tree, and that this :ref:`Path3D<class_Path3D>` has a :ref:`Curve3D<class_Curve3D>` 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_PathFollow3D_property_rotation_mode:
.. rst-class:: classref-property
:ref:`RotationMode<enum_PathFollow3D_RotationMode>` **rotation_mode** = ``3`` :ref:`🔗<class_PathFollow3D_property_rotation_mode>`
.. rst-class:: classref-property-setget
- |void| **set_rotation_mode**\ (\ value\: :ref:`RotationMode<enum_PathFollow3D_RotationMode>`\ )
- :ref:`RotationMode<enum_PathFollow3D_RotationMode>` **get_rotation_mode**\ (\ )
允許或禁止在一個或多個軸上旋轉,這取決於使用的 :ref:`RotationMode<enum_PathFollow3D_RotationMode>` 常數。
.. rst-class:: classref-item-separator
----
.. _class_PathFollow3D_property_tilt_enabled:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **tilt_enabled** = ``true`` :ref:`🔗<class_PathFollow3D_property_tilt_enabled>`
.. rst-class:: classref-property-setget
- |void| **set_tilt_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_tilt_enabled**\ (\ )
如果為 ``true``\ ,則 :ref:`Curve3D<class_Curve3D>` 的傾斜屬性生效。
.. rst-class:: classref-item-separator
----
.. _class_PathFollow3D_property_use_model_front:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **use_model_front** = ``false`` :ref:`🔗<class_PathFollow3D_property_use_model_front>`
.. rst-class:: classref-property-setget
- |void| **set_use_model_front**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_using_model_front**\ (\ )
如果為 ``true``\ ,則沿路徑移動的節點會將 +Z 軸作為前方向進行朝向。另見 :ref:`Vector3.FORWARD<class_Vector3_constant_FORWARD>` 和 :ref:`Vector3.MODEL_FRONT<class_Vector3_constant_MODEL_FRONT>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_PathFollow3D_property_v_offset:
.. rst-class:: classref-property
:ref:`float<class_float>` **v_offset** = ``0.0`` :ref:`🔗<class_PathFollow3D_property_v_offset>`
.. rst-class:: classref-property-setget
- |void| **set_v_offset**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_v_offset**\ (\ )
節點垂直於曲線的偏移量。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法說明
--------
.. _class_PathFollow3D_method_correct_posture:
.. rst-class:: classref-method
:ref:`Transform3D<class_Transform3D>` **correct_posture**\ (\ transform\: :ref:`Transform3D<class_Transform3D>`, rotation_mode\: :ref:`RotationMode<enum_PathFollow3D_RotationMode>`\ ) |static| :ref:`🔗<class_PathFollow3D_method_correct_posture>`
校正 ``transform``\ 。\ ``rotation_mode`` 隱式指定如何計算姿勢(向前、向上和側向)。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要使用者覆寫才能生效。)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (本方法沒有副作用。不會修改該實例的任何成員變數。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了這裡描述的參數外,還可以接受任意數量的參數。)`
.. |constructor| replace:: :abbr:`constructor (本方法用於建構一個型別。)`
.. |static| replace:: :abbr:`static (本方法無需實例即可呼叫,因此可以直接使用類別名稱呼叫。)`
.. |operator| replace:: :abbr:`operator (本方法描述將本型別作為左運算元時可用的有效運算子。)`
.. |bitfield| replace:: :abbr:`BitField (此值是由下列旗標組成的位元遮罩整數。)`
.. |void| replace:: :abbr:`void (無回傳值。)`