godot-statecharts icon indicating copy to clipboard operation
godot-statecharts copied to clipboard

Add the ability for AnimationPlayerState to automatically transition to other states when the animation ends.

Open shanayyy opened this issue 7 months ago • 6 comments

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. 01

shanayyy avatar Jul 11 '24 14:07 shanayyy