How can I get the relative velocity or direction of a player?

I wanted to know if there is a way to get the relative velocity or direction of the player.

In my context I want to improve my current dashing blueprint, since the current relies on the “Get Velocity”, so the more dominant direction gets the dash boost, something that I don’t want. I want that the dashing gets applied to the direction of the appropriate key (relative to the player), not to his velocity in the world. So if he presses the right dash button, that the player gets a boost to the right from his perspective.

Any ideas on how to achieve that?


I had this problem for a while too!

Use the Unrotate Vector node, with the velocity and rotation of the characters as input.


The following is from my animation Event Graph, I wanted to change the animation depending on the character’s relative velocity.



Thanks for the idea, but it didn’t achieved what I was looking for (maybe it has something to do with my input or with my dash function itself), but thanks to you I got an idea that works.

This example is for the forward dash, for backwards the X value just need to be made negative, for R/L you use the Y value.

ah few I was stuck on that too, i didn’t think there would be a unrotate vector! thanks Acren

Hi I was just working on a dash and came across a similar problem. Here is a blueprint I’m using that I got to work pretty well. It’s not perfect, but it’s pretty good.

Basically it checks if the character is walking, and not dashing, then sets a bunch of stuff, like no gravity, no friction, no braking so it will move uninterrupted in that direction. It then sets the dash vector based on the last player input. This is what you want since it bases the direction on player input, not velocity. Then it sets velocity, cause I have a short animation of the player getting into a dash stance, sets rotation rate to zero so the player can’t rotate after the dash has started and make it look wonky. Then it sets the player to rotation to the direction of the dash. That delay is just the time of the warm up animation, then he dashes. After that there is just a delay (how long the player dashes), and all the things I set at the start are reset to their defaults. I also set the velocity to 0 again. This way if you dash off a cliff, then dash will end and the player will fall straight down, rather then carrying on the momentum.
Hope this helps

1 Like

For those requiring a C++ solution this is how to do it:

FVector V = MyPawn->GetVelocity();
FRotator R = MyPawn->GetActorRotation();
V = R.UnrotateVector(V);

I Love You

Arghh, I was trying to rotate it when I should have been unrotating… Can some smart guy explain why this, in layman terms?

Ran across this post looking for something else, but it helped me out too.

I don’t know if this is of interest but…

UnRotate Vector can be used to get a speed measure across the narrow dimension of a wing or fin.
Then a proportional opposing force can be applied, simulating air-resistance.

Good for simulating airplanes and darts and so forth. (c:

Great man really helped me moving my UI in the opposite direction that the player is moving Very Cool