How to get linear velocity in a specific direction relative to the pawn?

I wanted to get speed of my plane, so I used get linear velocity node. Then I got actor rotation and get forward vector because I just wanted it’s speed along its local x-axis not in every movement direction. Is there a way to just count the positive values for this x-axis, because atm it also counts the negative values. I would prefer if the speedometer stayed at zero when the plane is moving in reverse. I’m using the speed to trigger some simple gameplay, and animations. There is probably a really simple answer to this, but I’m completely overlooking it.

Use the MAX node and connect your calculated speed into the first pin and put ‘0’ in the second one.

1 Like

thanks for the suggestion, but it didn’t work. it always measures Speed as a positive value even when moving backwards.

I tried clamping the x value of the forward vector between 1000 and zero. This give 0 on speedometer when traveling in -x direction of world space axis, unfortunately I need it locally for the -x axis of my pawn.

Finally. I got it to work. Thank for the max node suggestion. Really helped set me on the right track

This answer didn’t work for me. So here is my solution for other people with this problem. And if the original works and I did something wrong this is a shorter solution.

Just realized if you only want the forward velocity you only need these nodes.

This is working, thanks!

Thx mate it worked for me, add to re rotate it to the player with get socket rotation and rotate vector, that after the x return value, it add a counter force

thanks, worked for me to figure out the speed for a flying pawn (animations change when going forward or backwards) this solution was great!

great it worked for me

After calculating the speed, you can use abs node. This node keeps positive value the same and makes the negative value to positive, which is what speed is normally.