How do I access the player's current speed in blueprints?

I’m currently creating an infinite runner game, and I would like to show the current speed on the UI.

I cannot figure out how to access this, I’ve tried getting the players forward vector and length, which results in the UI either showing : 0 for not moving and 1 for moving.

I’ve also tested pick-ups that boost speed and traps that slow the player, and the number still stays at 1.

How can I achieve the result I’m looking for?

Any help would be greatly appreciated.

1 Like

Assuming you’re in your character’s blueprint:

  • Get velocity
  • Convert this to a scalar by getting its length

I beleive the forward vector is a unit vector, which would explain why it doesn’t change length when the character speeds up or slows down.

14090-speed.png

3 Likes

Fantastic, that worked perfectly. Thank you!

How would you get this to print and update rather than print a whole flood of text to the screen?

You could set a text variable and have that be bound to some text in UMG, I used some maths to convert the vector length to mph.

nice saved me

Ahh how obvios! I knew how to get the velocity, but failed to convert it to a float. I never used the ‘vector lenght’ node in my blueprints befor. Now I will always rember it. Thanks!

You can also just open the print string (Down arrow) and set duration to 0

i have it but it still prints 0?
im trying this in 2d is there a different method for 2d?