Make Character Dash Towards Movement Direction

So i’ve been using Cobra Code’s Dash system for my game and its wonderful.

However, the character only dashes towards the direction hes facing and I want him to dash towards whatever direction he’s walking to.

(If he’s walking backwards I want to set his rotation towards that direction and dash)

I tried to use “Get last input vector” instead of “Get actor forward vector” and it works, but the dash force is only applied when im holding down the key, meaning if I let go of one of the “WASD” keys mid dash animation, the character just stops.

I feel like this is an easy fix, but i’m lost on how to snap his rotation towards where he’s walking to.

First you need to understand what your input is relative to. If you are using the Third Person example it would be relative to the controller (camera). So get it and transform that direction and store it.

Next you need to have a fallback if there is no input. (it is usually “backwards” but you might use your character’s facing direction instead)

After that you just rotate your character and play your animations and timelines.

1 Like

the easy fix is to save the GetLastInputVector before the timeline starts.

1 Like

Hey thanks for responding

It works!

Now the force is being applied even when i let go of one of the “WASD” keys and the character snaps to whatever direction hes walking to.

The problem is now that the dash force seems to be influenced by the world axis

If im facing one way the character dashes correctly to towards all directions but if im facing the oposite way, or any other way, the dash force seems to pull my character.

Why does this happen and what could be the fix ?

Here’s the full line of code

Im using 8 directional movement btw

Thanks for your time.

(Can only upload 1 pic)

I’m still figuring out UE

Could you send the link to a tutorial on how to do this ?

Thanks

Hello again

Fixed!!

All I had to do was to switch “Get actor Transform” for “Get Velocity”

It’s working perfectly

Thank you!!!