Download

blend poses for each hand separately?

I’m trying to get a melee system to work where each hand is separately controlled by each mouse button.

For example, if left mouse button is held down the character raises a shield with the left hand and if the right mouse button is pressed the character swings a weapon with the right hand.

I’ve got two separate animations (in two montages), one where the left hand raises/lowers a shield and one where the right hand attacks (with some spinal rotation as well for a bit more “powerful” looking swing )

I’m having a lot of trouble getting this to work with the “layered blend per bone” nodes in my anim graph. The problem is that doing each thing separately works fine, however if I try to swing the weapon while holding the shield up, the left hand goes into the default t-pose position instead of remaining up. Likewise, when raising the shield the right hand goes into the t-pose position.

I’ve created two slots, one for the upperbody and one for the left hand.

I’ve got two layered blend per bone nodes, one for each slot and made sure they’re affecting the correct bones. The attack animation starts affecting the spine and the left hand animation only affects the left hand. Screenshot here:

I’ve tried switching the layered blend per bone nodes around and various other setups without any luck.

I’m probably doing something very wrong here, using incorrect nodes or something but I would greatly appreciate some tips into how this could be done properly.

You could use an AimOffset to raise or lower the shield. Keep the AnimGraph states for locomotion and blend per bone with a montage to do the attack.

That would be basic setup, more advanced work would include adding a rotation to the lower body for the duration of the attack animation so both bottom and upper halves work well together.

I think your problem is the nesting or chainlinking.
try this save a cached pose after the first blend,
Call in the cached pose and apply the second blend.

All in all its not uncommon to have 4 or 5 cached poses if you open a paragon character you’ll see similar stuff with the aim offset plus foot motion.

Pro tips.
Remove any and all spinal rotation from the animations, transfer it to a curve, apply the curve to the pelvis.
that’s Rotation on one axis, so if you bend forward because the weapon is a mace for instance you can still bend the spine forward via either animation (all bones) or by creating a specific curve and implementing the spine node with it, or a FABRIK node, or even a regular IK node.

And hey, let us know if caching the poses separately made any difference :wink:

You can do what you ask using a single blend per bone by adding a pin. You can then switch the blend on and off by changing the blend weight

Thanks for the reply! So something more like thisshould do it? Unfortunately I still can’t get it to work, I’m probably doing something incorrectly still. At least now I can easily play the animations on each hand without the other hand going to a t-pose so it’s a step in the right direction, but they still won’t play over each other. (there’s a video on the bottom of this post)

I’m wondering if it’s maybe the way I execute these montages thats the problem. Here is how I play the montages on mouse clicks in the character blueprint. Perhaps I should be doing something more instead of simply playing montages? Should I be creating states as well for the “shield held up” instead of just relying on a loop sequence in the montage if the left mouse button is held down?

Wow, thanks for the tip, that’s a little bit too pro for me yet. I did remove the spinal rotation from the animation and I’ll try to use this method when I’ve figured out how to play the other two animations over each other.

I gave this a try as well, something like this I assume? It got the same results as the above, where only one montage plays, the other stops. For example if I attack while holding the shield up, the shield goes down instead of remaining up and vice versa. Which kind of leads me to think that I should be creating states (at least for the shield holding) rather than just relying on two montages playing on mouse clicks as I mentioned above.

Here’s a short video clip of the problem, apologies for terrible animations they’re just very quickly done placeholders while I figure this out:

The rule of montages is only one can be played at a time so when a montage starts the current one is stopped.

The work around is to tie the actual animation take into the the added pin

. Bets practice is if you could post and example project with the problem I and others can look at it.

Thanks again for the help. Here’s the project files, all the blueprints that are used are in the content\meleestuff folder: https://drive.google.com/open?id=1PThIUk6FlNCYK07ySySEIEp2LM3p_Naq

By tying the animation into the pin do you mean somehow like this using the play anim node?:

I’m more oldschool on this stuff so I can just give you simple situation that will fix the problem but requires a lot of work.

Create a specific state machine within idle (a nested state machine)

Add a specific shield up animation to idle

The shield up idle has 3 states, raise, hold up, release.

hold up is the regular Idle state when the shield is up.
from this state you also manage hit reacts in a pre-scripted fashion. Say the shield breaks during gameplay? You can now add a toss shield anim before returning to idle.

Ideally maybe one would blend this new state machine on the pelvis so as to preserve the original movement animation from the cached pose / combat state.

in orer to do that need to cash the new motion group on it’s own and blend the 2 by bool probably based on a “shield up” bool.

The second note I have, the montage for the shield is a bad idea anyway if you want a rock steady animation or something with a little more flair then the arm just going up. Additionally extra states are a necessity if you are planning on receiving hits to the shield and addressing a reaction accordingly.

You may also want to consider just extending the whole shield state to a full motion control type thing.
you rarely walk the same when wielding a sword/shield than you do without.
All depends on the level of realism you are hoping to reach and how much time you have to make the game… personally I see no reason why indy games can’t be better then anything any major publisher makes…

Thanks! Finally got it to work using a nested (or second?) state machine. Now I can work on the other stuff you mentioned more easily, being hit etc.

Pose caching and when to blend this or that was a bit confusing at first but I’m finally figuring this stuff out after a lot of testing. Greatly appreciate all the comments here guys, thanks a lot.

I’m wondering if you could clarify a bit on the spinal rotation tip from earlier, any spinal rotation would simply be driven by a curve rather than an animation, I assume?

Would the curves be created in the animation editor of each animation (as shown in the UE documents here) or somewhere else?

Here if you are ready for it, watch this series (skip trough since they are all around 1 hour long vids) Animation Blueprint Setup & Walkthrough Stream Recap - Unreal Engine

An example of a good spot for a blend space way of moving

Then it jumps into explaining the rotation of the root bone and stuff so you can keep watching from