Download

State Machines: create a universal transition?

In an AnimGraph’s State Machine, is there a good (read: ELEGANT) way to define a state and corresponding transition rule so that it always overrides any other states no matter what?

I can create a conduit, for instance, and put the check for whether or not the state should be entered in that… But then, I have to connect a pin from every single state in the state machine to it. At present, that’s something like 30 states, all of which have to connect to this single Conduit pin, and there’s just no way of doing that that doesn’t look completely insane.

Is there a way to define a global state transition in this way? Note that putting some sort of blend outside the state machine is not really an option, since the state needs to cancel the state machine’s current operations (i.e. the transition needs to interrupt any currently-active anim state so that when the new anim ends, it returns to the idle state rather than to whatever its previous state was.

If you have a Many-to-One relationship, where One overrides the rest, is it not better to add this logic outside the state machine? So you blend the state machine in/out while blending to this “state” which we can consider global.

Well again, the problem with this is that blending out of the state machine doesn’t change the status of the state machine.

Literal example: the player’s “take damage” anim should override all states. Now, suppose the player is in the middle of reloading, or jumping, when he takes damage. I blend to the take damage anim outside of the state machine, and when I blend back, he’s still IN the aforementioned state (reloading, jumping, whatever). He never actually left that STATE, so I can’t govern the transition out of it properly; i.e. no matter what, if the player takes damage, he should always end the taking of damage by returning to the idle or fall state depending on whether he is grounded or airborne. That animation should not simply replace the current animation, it should govern the state of the player appropriately, ending whatever other animations might have been transpiring before he took damage.

Granted, I CAN try to make sure that the taking of damage, in the event graph, stops all relevant montages and unsets all relevant variables appropriately when it sets whatever bool I use to blend the poses outside of the state machine, but that seems almost as inelegant as just creating a many-to-one state and making my state machine look terrible (at least, terrible-looking or not, the functionality is consistent with the way the rest of the state machine works)

Is the take damage animation a montage or animation?

Probably a single animation, perhaps a “blend poses by Int” type configuration to account for front damage, back damage, etc.

Certainly nothing so complicated it required a montage.

Yea this sounds like the ‘Any State’ Transition in Unity. its a special node with transitions on it, in this case a line from Any State to Idle checking to see if Damage has been taken, it overrides everything and blends back to where you want it.