Player Character lunge forward while doing melee attack (inquiries about multiple attempted methods)

As the title suggests, I’m trying to have my character lunge forward while doing a melee attack. The initial attack animation that I put on my character has no root bone translation, and is a basic punch (with an upper body slot set in the montage and state machine). I’ve done some research, and so far the methods I’ve tried are not working out, so I have a question about some of these methods:

  1. Launch Character node - seems simple enough, but found out it makes the character go into a “fall” state, and just looks like I have my character almost floating forward for a brief second (even with Z launch velocity at zero). Is there a way to disable the activation of the falling state?

  2. Add Impulse node - Pretty close to the result I wanted, however, since the target node is the character movement component, the character sort of does a “stutter step” with his feet (probably because the sudden increase in speed is triggering an almost “run” state in the animation). The feet are jarring and not smooth at all. **Any way to get around this (ie, have the character just go forward and play the animation, without having the lower body animate oddly)? **

  3. I changed to an animation I got from the Epic Store with a root bone translation in the forward direction (ie, a forward dash with a punch at the end) and turn on “enable root motion”. However, the character travels too far forward, and I don’t know a way to reduce the travel distance of the root bone within engine so far (without having the animation live withing the state machine, which I do not want). Is there a way to reduce this forward translation without going into a 3rd party app?

  4. Edit that animation (in #3) in a 3rd party app (i’m using maya). I exported that animation out of UE4 and into Maya - but the twist bones are messed up! I’m unfamiliar with animation, so any help with this i would gladly appreciate. Am I simply exporting this wrong out of UE4 (Are there proper settings I need)? Or are animations exported out of UE4 not conventional? Also, how do I go about exporting the skeleton with an A-pose?

As you can I see I went through my options, and I usually figure this stuff out without posting in the forums, but I am a novice when it comes to animation and UE4, so I thought it’s worth a shot posting here.

Thanks.

-N

  1. easy fix.
    change the movement type to none. Set it back to walking after its done.

  2. easy fix. Set a boolean in the anim BP and throw the character in the proper punch animation. If you hook this up from all possible entries you’ll get the result you need without stepping (this assumes that you are in fact having an issue with the animations).

  3. you can try to edit the animation in engine. There are several ways to do so. Personally never used any, but they do get covered in the live trainings a lot.

  4. The translations being wrong is somewhar normal. It is a result of bad animations that are sold or made free in the marketplace. (I don’t care what your (the creator’s) pov may be on this. If your wrist, or any bone, is not correct with a full skeleton set to Animation the Animation you sold is BAD.)

This is probably what you are experiencing in maya.
You can try adjusting. But you can probably ignore it and move just the root for now.
When you learn more you can go back and fix it.

Or you can try my blender plugin. It will fix it.
http://mosthostla.com/gamedev/bonebreaker/

I never acrually tried importing a root animation though. At worse it will stay in place. At best it just works.
Export works as intended.

For the A pose, you are better off exporting it from the engine so its the exact pose. Just export the skeletal mesh (sk_mannequin).

If you have a custom mesh, retarget the animation to the mannequin, then export.
when importing back you just select the proper skeleton or re-target it again.

Hey thanks for this! Appreciate it.

I’m slowly going through the recommended fixes that was outlined.

  1. Tried this, but this seems to stop movement (ie, translation of the character) completely (thus no forward lunge). This was how I set it up, not sure if I’m doing it right


    Instead, I tried this:

    Essentially, made it so that my “is in air” boolean in my anim graph is set to false before the launch character node ever touches it, and then set it back after. The “Max speed Lower A” alters the speed variable within the anim graph during this time frame (dividing it by a float and clamping the max value) to minimize “stutter stepping”. I’m not sure if I’m fully committed to this yet. Any feedback on this would help.

  2. I have yet to try this. The thing is, my “melee attack combo” is set up in my Character BP, not the Anim BP. I’m reluctant to transfer the attack combo to the Anim BP because I THINK it is standard to have the combo within the Character BP than within the Anim BP (if the Paragon Assets and other tutorials have lead me to believe).

  3. Will look into this! Thank you.

  4. You are probably right about the animations being “bad”. As a test, I exported the standard animations that came with the SK skeleton, and they imported perfectly (no odd displacement of “twist bones”), unlike the animations I bought from the Epic Store. Also thanks for the Blender youtube tutorial within the link you gave me! I copied the export settings for UE4 from that video and it worked great. Still, twist bones are whack, but like you said, when I just adjusted the root bone translation and exported it out back to UE4, it worked fine. I will give any that blender plugin a try soon.

**Further Question regarding Melee Attacks with forward translation: **

[Directed at anyone who can shed some light on this topic]

  1. So, after all of this, I’m under the assumption that the melee attack with a forward translation (eg, lunge) seen in most games (Dark Souls, God of War 2018, Sleeping Dogs) is mostly root bone driven, as opposed to “force” driven. Please correct me if I’m wrong. What is the standard for this for most action games?

  2. Although I got the “launch character” to work as I intended, I find it too fast of a translation forward (too sudden - thus with the “stutter stepping”), and want a slower and smoother transition in the forward direction during a melee attack. Is this possible? I’ve tried the “Move Component To” but I foresee some problems with this, like if my character attacks right at the edge of a cliff, translating forward with no respect to gravity, or clipping through walls.

-N

  1. its easier to animate the bone, but it can cause you to clip trhough walls. So you end up mix/matching to prevent that.
    Or just using a physics system.

  2. you just need to learn to code stuff on a repeating loop.

Thing about this, every command you put into the chain is being executed one after the other, at a 1 tick interval.

So, if you revisit the way you set up the disable walking/enable waking you’ll realize thay you are telling the engine to disable, apply physics, and then set back to walking immidiately one thing after the other.

Obviously, this will not normally work.
expecially when you need movement over time.

You need to come up with a system that steps through the steps, but lets each step occur freely until completed.

In the case of the inpulse the way you have it, a simple delay may suffice.
however to speed up over time you need to apply the other node over time to accumulate speed.

I would suggest triggering a boolean and applying the force on tick up to a maximum amount.

I did this recently with my character. I used an anim montage with root motion enabled. The animation itself has the jumping applied to the root bone. You also need to set the character’s movement type to “flying” or they will not be permitted to leave the ground. Then turn it back to “Walking” once the montage completes. This worked perfectly for me and does not clip through collision objects like walls or other actors.

I recommend doing it with a timeline and set world location (with sweep on) with the initial position + the position of the timeline. This gives you exact control over the trajectory and is something that is very easy to adjust for different abilities, power ups etc.

The timeline idea is good, it also allows you to define a custom curve so you can manage the acceleration however you want.
If your interest is customizing the way the lunge occurs in engine, this is really the best way.
you can set the curve to output the Z and the X of the forward vector and just slide the actor around.
Or you can add impulse however you see fit.

Hey guys, thanks for the suggestions. Just to update, I did happen to use a timeline, but I did not use world location (however, this advise seems promising, I will try it out!). Instead, I used this:


It adds impulse over a timeline, which does affect the movement component (which, I would assume, if you have the animation set up correctly, the character can run during the velocity change), which is a plus. Good for my uses so far, and respects gravity too.

Cheers

Also it’s worth noting that the “stop” timeline loop is here because my character would seem to accelerate forward after falling off a cliff (while doing the montage) without it. With this, it stops the impulse as soon as my character lunges forward off a surface, resulting in a more natural landing.

I was facing a similar issue when I create the knockback effect which will be applied once my player attacked the character. And I solved it by this which was huge inspired by vib’s recommendation.