Skip to content

Add support for AnimationTree state machine teleport blending #11769

@Iceball457

Description

@Iceball457

Describe the project you are working on

A 3D platformer with an arbitrary combat state machine and a 2 dimensional blended ground movement animation.

I cannot fully define the animation state machine without manually adding an absurd amount of transitions, because any move can cancel into any other move (but only while equipped with certain items). There are 12 weapons, each with 12 normals. With 144 normal attack animations, that's already 20,736 identical transitions without considering the more quantifiable platforming section of the state machine or the special moves.

Describe the problem or limitation you are having in your project

Arbitrary/code-driven animation transitions powered by a state machine are not currently compatible with the complex blending behavior provided by AnimationTree (AnimationPlayer does not accept BlendSpace2d, for example).
AnimationTreeStateMachine is compatible with all the AnimationNode classes to support complex blending, but it is impossible to blend smoothly between animations without manually defining all those transitions.

In the case that a node's state machine is primarily defined in code, and the animation state machine is merely mimicking the node's state, you currently need to model the state machine structure in the animation tree. For model state machines with modifiable transitions, or unknown/arbitrary transitions, you would need to add a transition between every pair of animations in the animation's state machine.

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

There are many potential solutions. Primarily, the lack of ability to blend between arbitrary complex blended animations:

  • A new child of animation mixer that supports AnimationNodes in addition to AnimationMixer animations.
    • This is the most formal method, but would require significant work that I believe is unnecessary.
  • Adding functionality to the "default_transition" field that is present but unused in AnimationNodeStateMachinePlayback.
    • This still requires the user to add all desired AnimationNodes to an AnimationNodeStateMachine in the root of an AnimationTree, but the user would have to define a set of AnimationNodes anyway, so doing it inside the already existing UI seems completely reasonable.

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

AnimationNodeStateMachinePlayback has a field called "default_transition" that is defined but completely unused. This proposal moves the field to AnimationNodeStateMachine, defines a Member to allow the user to specify its value in the AnimationTreeStateMachine inspector, and uses it whenever the StateMachine wishes to teleport.

The default value of the AnimationNodeStateMachineTransition as provided by the GUI should be identical to the previous teleporting behavior.

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

As far as I can tell there is no way to mimic this behavior at all, not to mention in a couple lines.

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

Animation is core.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Work in progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions