Announcement

Collapse
No announcement yet.

"Global Animation" when using different state machines for body parts

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    "Global Animation" when using different state machines for body parts

    Hi together,

    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.

    #2
    Normally you have a base animation that handles idle/movement (Just add the dodge roll to that).

    Then on top of it you have 1 slot for upper body that is generally independent because it is activated via montage rather then state machine.

    The player character does trigger animations directly as they are nothing but a result of a button press - so even if in AnimBP they are factually still a deferred call generating directly off player input or the character class.

    You can definitely create an upper body relative state machine and use it, but it overlays to the motion state machine so just create an attack idle state and transition to it. Its just a copy, but specific to any attack you trigger.
    That way if you are idling you can keep the bored idle animation as it is, the transition between attack and idle will be mirrored by the fake idle state for the attack.
    You should do the same for movement too.

    Comment


      #3
      Originally posted by Fred_FS View Post
      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.
      I usually have a slot as the last node before output in the anim graph. All the state machines and everything else feeds into it's input. I'll typically name it "Full Body Anim" and this works well for animations like Rolling Dodges, rolling attack and death/recovery sequences.

      In your setup you can do the same thing. Feed your combined output from the two state machines into this slot and let it override everything.


      UE4 Tutorials for 3rd person Blueprint project from scratch: Youtube Channel
      Use Blender 2.8 to make UE4 compatible animations: Blog

      Comment


        #4
        Thank you for your answers, they help me to get a clearer view for the UE4 animation system.

        Originally posted by MostHost LA View Post
        The player character does trigger animations directly as they are nothing but a result of a button press - so even if in AnimBP they are factually still a deferred call generating directly off player input or the character class.
        But do you never need more logic to those button press animations? So for example "attacking should only be allowed, if the player is not in another animation state"? Or would you suggest to always trigger those animations based on the button press? If I use different montages for the same slot, what would happen, if I play the attack montage during the blocking montage is playing? Would those animation blend smoothly?


        Originally posted by MostHost LA View Post
        You can definitely create an upper body relative state machine and use it, but it overlays to the motion state machine so just create an attack idle state and transition to it. Its just a copy, but specific to any attack you trigger.
        That way if you are idling you can keep the bored idle animation as it is, the transition between attack and idle will be mirrored by the fake idle state for the attack.
        You should do the same for movement too.
        I don't get this part. I tested my system with two state machines and I was able to run around and attack at the same time without the attack animation overlapping the motion animation. So the feet were walking, but the upper body was attacking. So I don't see, how an additional attack idle state might help here, if it does not overlap the lower body (and in most cases, I don't want it to overlap).


        Originally posted by Waves View Post
        I usually have a slot as the last node before output in the anim graph. All the state machines and everything else feeds into it's input. I'll typically name it "Full Body Anim" and this works well for animations like Rolling Dodges, rolling attack and death/recovery sequences.
        I checked out the documentation about slots and montages. If you use this "Full Body Anim" slot, do you have a montage for each of the animation sequences you mentioned (rolling dodge, rolling attack, etc.)? And do you just play this montage from your player character based on the event?
        However I currently don't see, how I could solve my bored idle problem using this system, because it still would depend on the animation state of the other animation state machines. Do you have an idea, how that could work?

        Comment

        Working...
        X