How to make a dash function?

We are trying to make a dash function that moves the character in the direction the right thumb-stick is pressed.
This function would look similar to the airdodge in Super Smash Bros. Melee.

Thank!

First of all you would have to register the input in the Project Configuration/Inputs

RightAnalogVertical
RightAnalogHorizontal

Then at every tick create the right analog vector like this:

FVector rightAnalogInput = FVector(RightAnalogVertical, RightAnalogHorizontal, 0.0f);
if(FVector.Size() >= SOME_MAGIC_NUMBER)
    this.Dash(rightAnalogInput);

And on the Dash function, assuming this is a character.

//Function Dash.
this.AddMovementInput(DashInput, MAGIC_NUMBER_SCALE, false); 

Now, if it where me, i would create a MovementComponent to add a Movement mode DASH, but that’s not necessary, it’s just more modular for me

The idea is that the magic numbers are variables that you can modify, not just hardcode

Greetings

I recommend using add impulse if you are simply trying to boost the character in a direction (with the target being the scene root). Now if you want them to float and not fall, you can change the movement mode to Flying briefly (using set MovementMode) and disabling it afterwards.
Another way to do this is to just set the WorldLocation of the character x units to the right/left of where they are and adding some form of animation in the middle to make it seem like fast movement.

Just a heads up this is under Blueprints :slight_smile:

woopsi, you’re right