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...
AnimationNodeStateMachineTransition¶
继承: Resource < RefCounted < Object
AnimationNodeStateMachine 中连接两个 AnimationRootNode 的过渡。
描述¶
使用 AnimationNodeStateMachinePlayback.travel 时生成的路径,仅限于通过 AnimationNodeStateMachineTransition 连接的节点。
可以详细设置过渡的时机和条件。
教程¶
属性¶
|
||
|
||
|
||
|
||
|
||
|
||
|
信号¶
advance_condition_changed ( )
变更 advance_condition 时发出。
枚举¶
enum SwitchMode:
SwitchMode SWITCH_MODE_IMMEDIATE = 0
立即切换到下一个状态。当前状态将结束,并混合到新状态的开始。
SwitchMode SWITCH_MODE_SYNC = 1
立即切换到下一个状态,但会将新的状态定位到旧状态的播放位置。
SwitchMode SWITCH_MODE_AT_END = 2
等待当前状态播放结束,然后切换到下一个状态动画的开头。
enum AdvanceMode:
AdvanceMode ADVANCE_MODE_DISABLED = 0
不要使用该过渡。
AdvanceMode ADVANCE_MODE_ENABLED = 1
仅在 AnimationNodeStateMachinePlayback.travel 时使用该过渡。
AdvanceMode ADVANCE_MODE_AUTO = 2
如果 advance_condition 和 advance_expression 检查为真,则自动使用该过渡(如果已分配)。
属性说明¶
StringName advance_condition = &""
void set_advance_condition ( StringName value )
StringName get_advance_condition ( )
该条件被设置时打开自动前进。提供的名称将成为 AnimationTree 上的布尔参数,可以通过代码进行控制(请参阅 使用 AnimationTree)。例如,如果 AnimationTree.tree_root 是一个 AnimationNodeStateMachine 并且 advance_condition 被设置为 "idle"
:
$animation_tree.set("parameters/conditions/idle", is_on_floor and (linear_velocity.x == 0))
GetNode<AnimationTree>("animation_tree").Set("parameters/conditions/idle", IsOnFloor && (LinearVelocity.X == 0));
String advance_expression = ""
将表达式用作状态机过渡的条件。可以为状态之间的切换创建复杂的动画推进条件,并通过直接与脚本代码交互为创建复杂的状态机提供更大的灵活性。
AdvanceMode advance_mode = 1
void set_advance_mode ( AdvanceMode value )
AdvanceMode get_advance_mode ( )
决定在使用 AnimationNodeStateMachinePlayback.travel 时该过渡是否应该被禁用/启用,或者如果 advance_condition 和 advance_expression 检查为真则自动行进(如果已分配)。
int priority = 1
当在树中通过 AnimationNodeStateMachinePlayback.travel 或将 advance_mode 设置为 ADVANCE_MODE_AUTO 行进时,倾向于优先级较低的过渡。
bool reset = true
如果为 true
,切换时目标动画从头开始播放。
SwitchMode switch_mode = 0
void set_switch_mode ( SwitchMode value )
SwitchMode get_switch_mode ( )
过渡类型。
Curve xfade_curve
缓动曲线可以更好地控制此状态和下一个状态之间的交叉淡入淡出。
float xfade_time = 0.0
这个状态和下一个状态之间的交叉渐变时间。