Directional melee combat

Devatsu
Fri, 31 Mar 2017 10:13:20 +0000
Character & Animation

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?

7 posts - 1 participant