I want to implement basic character animations (currently using an animation blueprint). The character shall be able to walk around, attack with a weapon (e.g. a sword), block with a weapon, do some kind of roll to evade attacks, jump and so on.
I watched different videos and read different threads and it seemed that a simple solution would be to use different state machines for the upper body part and the lower body part and then one state machine is doing the attack/block stuff while the other state machine handles the walking animations and then I use a layered blend per bone to combine the two animation state machines. So far this is working quite well.
However I am now wondering how to implement “global” animations such as a dodge roll. In that case I would have to override both state machines in some way.
Or another idea that came into my mind what about “bored animations”. Let’s say I want the character to do some special idle animation when the player makes no input for about 5 seconds. My originally approach to handle this, when I had only one state machine was to simply create new states that were entered after remaining some time in the idle state. But with multiple state machines that’s pretty difficult, because I only want to switch into a bored idle animation state, if both state machines are idling for more than 5 seconds. Otherwise in a fight the player’s legs might suddenly play the bored idle animation, while the upper body is fighting against monsters. Or while running the upper body suddenly starts to move awkwardly because there has not been an attack since 5 seconds.
Do you have an idea how to solve my issues in an elegant way? Of course I could for example track in the player character the time between inputs and if this time is >5 seconds just play this idle animation from the player character (a similar approach would also work for the dodge animation). But this way seems not to be clean for me. In my eyes the player character should not trigger animations directly, because that should be the concern of the animation blueprint.
Thanks for your ideas and solutions in advance.