Directional melee combat

Hey guys. I’m new to Unreal Engine and coding in general, and I’ve gotten to where I am thanks to good tutorials.

So I’m aiming to make a fluid combat system that you can see in games such as Mordhau, Chivalry.

So far I’m tracing wherever the mouse is aiming, so it aims and can hit bones very neatly. I’ve got an anim montage as a placeholder at the moment. However, I’m now implementing a detection of mouse movement, so if you move the mouse to the right it will swing to the right, you get the picture.

I don’t want just 4 different types of attacks, where you’ve got the typical overhead swing, stab, left and right swing. I want a “360” attack variation, so you can swing from a high angle, low angle, etcetera.

So here’s my question: Should I run an animation whenever the blueprint detects where the mouse is moving? I don’t have any animations yet and the next option is what I find more convenient at the moment.

Or, alternatively, could I use the skeleton meshes bones to rotate the weapon holding hand through the animBP? I’ve played around with this option where I rotate the upper arm and the lower arm bones, but I’m having trouble coding a smooth transition between the bone rotations. I’m able to set the bones’ location to where I want the swing to start it’s momentum from (above the character’s head), but I’m unable to make it transition firstly from the default pose, into that high momentum position, and then where I want the attack to move. I believe that this could be an easy workflow to make these attack movements look fluid, and possibly save me from having to learn animation (I’ll have to do that sooner than later anyways, but I’m hoping to make a prototype of the gameplay before I begin modelling and animating stuff).

Along with a smooth transition between the rotations, I would also need the rotation to have some noise to make the movement look realistic. Any tips here guys? Here’s a picture of my code so far (been playing with it since I began writing this post, so now the rotation ends up where the second Rinterp aims to be at the end of the swing.

So, I’ve detected the mouse movement and it’s supposed to swing to the right. Here’s the picture:

P.S. How would I go about making a “power-up” movement? I guess for example I’d have the sword stay in the momentum-gaining pose when the input is clicked, and then the motion begins when I release the button. Does that sound correct logic-wise?

Did you figure this out? I’m also interesting in implementing a similar system.

I used animation montages to play the animations I have at hand from mixamo, so I’ll have to dive into the animation studies sometime in order to make high quality animations at a later point of time. I didn’t figure out how do to the bone-movement or do the charge-up. I’m also trying to find a way to make melee weapons able to block eachother, but I’ll have to learn some more of the basics first. :slight_smile: Hopefully someone pops by with some advice.

Bump. Still looking for ways to control the bones in order to make believable combat.

Anyone? Would love some assistance on this one.

If I were you, I’d check out Aim offsets. Aim offsets might be able to do the trick once you get your animations in order. You basically need to be lerping between snapshots from different swing animations - and this would be linked to your mouse position.

Bump.

Did you ever find a solution to creating the directional attacks? Ive been struggling for months now…