Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
PathFollow2D
繼承: Node2D < CanvasItem < Node < Object
對 Path2D 的點取樣的取樣器。
說明
這個節點接受它的父節點 Path2D 並返回其中一個點的座標,需要給定到第一個頂點的距離。
在不編碼移動圖案的情況下,它可以使其他節點遵循一條路徑。為此,節點必須是該節點的子節點。在該節點中設定 progress 後,後代節點會隨之移動。
屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
屬性說明
如果為 true,則兩個快取點之間的位置將進行三次插值,否則將線性插值。
沿著 Path2D 的 Curve2D 的點在使用前被預先計算,以更快的計算速度。然後在兩個相鄰的快取點之間計算請求偏移量的點。這可能會出現一個問題,如果曲線做急轉彎,因為快取點可能不跟隨曲線足夠近。
有兩種方法可以解決這個問題:要麼增加快取點的數量,增加記憶體消耗,要麼在兩個點之間進行三次插值,但代價是(稍微)降低計算速度。
節點沿曲線的偏移量。
如果為 true,路徑長度以外的任何偏移都將環繞,而不是在結束時停止。對於迴圈路徑使用它。
沿路徑走過的距離,單位為圖元。改變這個值會將這個節點的位置設定為路徑上的某個點。
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 Path2D which is part of the scene tree, and that this Path2D has a Curve2D with a non-zero length. Otherwise, trying to set this field will print an error, and getting this field will return 0.0.
如果為 true,則該節點會跟隨路徑旋轉,+X 方向朝向路徑前方。
節點垂直於曲線的偏移量。