godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Allow animation blends/transitions to be interrupted in StateMachine #2200

Closed Flavelius closed 1 year ago

Flavelius commented 3 years ago

Describe the project you are working on

RPG-like multiplayer with many npcs

Describe the problem or limitation you are having in your project

Most of it is already described in this issue:https://github.com/godotengine/godot/issues/43570 The gist is that transitions in progress can currently not be interrupted. This prevents setting up good/professional looking animations as it is quite common to interrupt animations for gameplay reasons and certain transitions are naturally required to be longer.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Just having that be available/implemented will already be the fix.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

It could be an exposed option for transitions in blendtrees, statemachines and an argument in the play method of the animationplayer.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It cannot be worked around.

Is there a reason why this should be core and not an add-on in the asset library?

It's part of the core engine

TokageItLab commented 3 years ago

It will probably be an improvement to the AnimationNodeStateMachinePlayback, or maybe AnimationNodeStateMachineTransition.

@Flavelius So the problem is that you can't force a transition with fast x-fade by using the current start() of AnimationNodeStateMachinePlayback, right?

Flavelius commented 3 years ago

So the problem is that you can't force a transition with fast x-fade by using the current start() of AnimationNodeStateMachinePlayback, right?

I'm mainly using travel(), but i guess start is the same; and if, by fast x-fade, you mean immediately beginning a new transition (with its own duration) from a current transition state (any point in time in that one's duration), then yes. Similar to how it would look if you started a position tween and stopped it in the middle and started a new tween to a different position, the target would continue from the last tween's middle position to the new end position.

YuriSizov commented 2 years ago

@TokageItLab Is this something that is being worked on?

TokageItLab commented 2 years ago

There has been a major implementation as https://github.com/godotengine/godot/pull/61196 in the last few weeks, but I am not familiar with it if this has been resolved or not. I remember that at least the transitions were still broken. @fire @lyuma Does Advance Expressions interrupt the current state and perform the transition correctly?