State machine without manual transition rules?

I’ve been using an animation blueprint with a state machine to control my character’s animation. The animation that should play is controlled by an Enum state variable. However, in order to use a state machine, I’ve been declaring transition rules for moving between each animation. This seems unnecessary because the transition rules are all simply Enum == TargetState. It seems like there should be a better way to obtain this logic.
Is there a way for the state machine to transition automatically based on the value of an Enum without requiring manually-set transition rules between each pair of states? Or is there some other way to obtain the same result?

Hey @Kyr0TheHero!

That really depends on the type of animation. Would you mind sharing:

  1. The function of the animations you are transitioning between (idle, walk, run, shoot, etc.)
  2. Your state machine

Any additional information and specifics you can provide will go a long way in solving your problem!

Thanks for your reply!

I’m working on combat animations, which include idle, walk/run, shielding, shieldstun (plays when a character is hit while shielding), and shield break. I plan to add various attack animations. Below is an image of my current state machine:


I’m wondering if there is a way to implement this functionality or something similar without manually setting transition rules between every pair of states.

OK to even begin to present a logical answer we need some kind of context is in how the design needs to work.

State Machines work very well when a sequence needs to occur with in the context of the required, individual, animation takes. For example Jumping needs a start, while in air, and land. As a part of what is know as context based animation, as in it’s a sequence that can and should only occur when jumping it can be added to the state machine as part of the migration pathway but as you say requires a transition rule to exit the pathway and into another, like running.

Thing is over time Epic has added better ways of triggering context based animations as to when the state change is required with out the need for transition rules. For example you can not do proper animation layering as to say “Shielding”. For that matter as you suggested it is possible to switch the current state using Enum == TargetState to switch the required state change using an animation tree, and avoid the need of transition rules as the TargetState sets the desired migration path with in the animation tree. If confusing I can expand or even show an example as I use trees to switch the state based on context and use state machines to keep things clean. More or less the long way around to say no you do not need to use state machines, 1990 tech, and bypass the use of transition rules.