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...
AnimationNodeStateMachinePlayback
繼承: Resource < RefCounted < Object
提供對 AnimationNodeStateMachine 的播放控制。
說明
可用於控制以 AnimationNodeStateMachine 建立的 AnimationTree 狀態機。使用 $AnimationTree.get("parameters/playback") 取得。
var state_machine = $AnimationTree.get("parameters/playback")
state_machine.travel("some_state")
var stateMachine = GetNode<AnimationTree>("AnimationTree").Get("parameters/playback").As<AnimationNodeStateMachinePlayback>();
stateMachine.Travel("some_state");
教學
屬性
resource_local_to_scene |
|
方法
get_current_length() const |
|
get_current_node() const |
|
get_current_play_position() const |
|
get_fading_from_length() const |
|
get_fading_from_node() const |
|
get_fading_from_play_position() const |
|
get_fading_length() const |
|
get_fading_position() const |
|
get_travel_path() const |
|
is_playing() const |
|
void |
next() |
void |
start(node: StringName, reset: bool = true) |
void |
stop() |
void |
travel(to_node: StringName, reset_on_teleport: bool = true) |
訊號
state_finished(state: StringName) 🔗
Emitted when the state finishes playback. If state is a state machine set to grouped mode, its signals are passed through with its name prefixed.
If there is a crossfade, this will be fired when the influence of the get_fading_from_node() animation is no longer present.
state_started(state: StringName) 🔗
Emitted when the state starts playback. If state is a state machine set to grouped mode, its signals are passed through with its name prefixed.
方法說明
float get_current_length() const 🔗
返回目前狀態的長度。
注意: 任何 AnimationRootNode 既可能是節點也可能是動畫,亦即單一狀態內可能含有多段動畫。何者長度優先取決於其內部連線的節點;若轉場未重設,則會返回當下剩餘長度。
StringName get_current_node() const 🔗
返回目前播放的動畫狀態。
注意: 采用交叉淡入淡出時,淡入開始後目前狀態即會切換為下一狀態。
float get_current_play_position() const 🔗
返回目前動畫狀態中的播放位置。
float get_fading_from_length() const 🔗
Returns the playback state length of the node from get_fading_from_node(). Returns 0 if no animation fade is occurring.
StringName get_fading_from_node() const 🔗
返回目前正淡入淡出的動畫之起始狀態。
float get_fading_from_play_position() const 🔗
Returns the playback position of the node from get_fading_from_node(). Returns 0 if no animation fade is occurring.
float get_fading_length() const 🔗
Returns the length of the current fade animation. Returns 0 if no animation fade is occurring.
float get_fading_position() const 🔗
Returns the playback position of the current fade animation. Returns 0 if no animation fade is occurring.
Array[StringName] get_travel_path() const 🔗
返回內部 A* 演算法計算出的目前行進路徑。
若有動畫正在播放則返回 true。
void next() 🔗
若因 travel 或自動前進存在下一條路徑,立即自目前狀態轉場至下一狀態。
void start(node: StringName, reset: bool = true) 🔗
開始播放指定動畫。
若 reset 為 true,則從動畫開頭開始播放。
void stop() 🔗
停止目前播放的動畫。
void travel(to_node: StringName, reset_on_teleport: bool = true) 🔗
依最短路徑從目前狀態轉場至另一狀態。
若目前狀態與該路徑不連通,將在傳送後播放動畫。
若 reset_on_teleport 為 true,行進導致傳送時會從動畫開頭開始播放。