Download

Trigger animation state machine transition With event

Hi, is there any way to trigger an animation blueprint state machine transition with an event, rather than evaluating booleans to trigger the transition?

I want to trigger a transition when an event is broadcast: with bools I seem to often end up with a lot of boilerplate to turn on the bool, turn it off, make sure it can’t fire again before it is reset, then reset it. It would be much more convenient to bind the transition to an event. I know I can do this with montages, but I would like to transition into a state machine.

Have you tried using a string instead of a bool for moving around the machine? You can make the state go anywhere you want, just by setting the string. Easier than lots of bools.

I also notice that animation blueprints implement interfaces, so you can send them an event that way. I guess you would send the call to the actor using the anim bp?

Thanks, I think these solutions still rely on some variable being set to trigger the transition. I really just want to trigger the transition with an event and not have to manage the state of the variable.

Well, like I say, you can use blueprint interfaces with the anim BP>

The interface still has to ultimately set a boolean though right?

In the end, you have to give the system a bool, otherwise it won’t enter the transition.

But this doesn’t mean you have to use bools in your code. One bool for each action, is a pain in the but, that’s why I say, use a text variable. Then at least you only have one variable for the whole thing.

Also, I notice, you can call the interface, but you can’t service the event anyway…

State Machines rely on transition rules. Rules require a gate keeper (conditional logic). So somewhere down the line you have to setup logic which relies on variables being set. There’s no way around that.

How complex, number of variables etc is down to your ability.

Using Enumeration (Movement State), Enumeration (Action State) is an organized approach, but it requires a function in the anim BP to set those two variables based on your character class inputs/actions.

1 Like