godot-statecharts
godot-statecharts copied to clipboard
Add the ability for AnimationPlayerState to automatically transition to other states when the animation ends.
A common use case for AnimationPlayerState
is transitioning to a different state at the end of an animation, e.g. returning to the idle state after an attack animation. Currently we have to handle this transition manually. This requires tracking the completion states of different animations and mapping them to transitions.
To make AnimationPlayerState
easier to use, I suggest adding a Next State
property to it. If a state is assigned to it, when the AnimationPlayer
emits the animation_finished
signal, if the anim_name
is equal to the animation_name
of the AnimationPlayerState
, and the AnimationPlayerState
is active, it automatically transitions to the state specified by the Next State
.