Animation State Machines: Enter from any State?

I’ve got an animation blueprint with a locomotion state machine that currently has 6 states and probably some more in the future. I believe I originally got it from some example project or tutorial, don’t remember… Now, transitioning from standing to running or jumping is all very straight forward, but what about states that can be entered from any state and at any time? I’m thinking about falling, hit reactions or death animations. I can’t draw transition-arrows with exactly the same conditions/rules from 6 or more states to all of these. My state machine will look like crap and be kinda redundant… Isn’t there another way?

No solution? Am I really supposed to draw a hundred transition arrows just to get a properly implemented falling state?.. And then draw a hundred more for the next “interrupting” state?

I am beginning to think I’m better off, if I just forget about state machines and write some code that sets a couple of bools and enums to be used directly in the anim graph with blend-nodes.

You can in c++ by calling:

void UAnimInstance::AddNativeTransitionBinding(const FName& MachineName, const FName& PrevStateName, const FName& NextStateName, const FCanTakeTransition& NativeTransitionDelegate, const FName& TransitionName)

Thanks for reply. What exactly is this doing? I mean, isn’t it exactly the same, only that I write a hundred lines of code instead of drawing a hundred arrows? Do the native transitions show up in the graph?

Sorry to necromance this, bu is there a blueprint way to achieve this?

I have a falling state that I want to enter whenever character is not grounded, regardless of the animation state he is currently in.

Try 6:58 in this tutorial

Thanks for taking the time to answer but this is not what I was asking about. I know the tutorial series and this is the normal procedure of tranistioning between states.

What I want to know if there is a blueprint way of defining a state taht can be entered from any other state (equivalent to the any state eature in Unity). If you have a lot of states where for example falling is viable option you would have to set up transition rules from every state to your falling state wich will end up in spaghetti like state machine.

So I was wondering if there is a way to define some sort of global transition rule.

You can create a state machine in any state, a nested system could solve your problem.

However I am not really sure how blending works between different state machines, it’s something I hope to find out soon.

Hi Elathan, I’m afraid nested state machines are no solution for this. It is actually not a problem, you can use “dummy” enter/exit states in every state machine as some sort wof workaround. but a global “any state” as in Unity’s mecanim would be a nice addition since it makes your animation states cleaner in some cases.

Maybe it isn’t nice, but it is the best working thing I found so far.
You have a single state with a state machine inside. Put every normal state into that sub state-machine.
Add a new state in the top level with the animation / logic which should be available from any state.

I found out about the dummy entry state, and I could refactor my really complicated animation blueprint from a terrible spaghetti yesterday - now I have some substate machines, but no wires between states are crossing each other anymore :slight_smile:

1 Like