Download

Distance for an endless runner

Hello,

I’m making an endless runner (first project) and trying to learn while making the game. Now I want to display the distance I’m current at (like 500 meters, 1000 meters) but tried differend things but none with succes. I creadet a widget hud (also used for pick up coins like in the unreal tutrial video) binding the number for meters but I dont get the blueprint right for knowing my distance to print it to the screen. Does somebody know the blueprint for knowing the distance the player has run.
All help is welcome :smiley:
Thanks in advance

Sorry for my bad english my mother language is dutch.

You should be able to calculate the distance making your own function, you can get the character velocity and current game time so you just need to use the formula: distance = velocity / time (supposing that your player is always moving at the same velocity (no acceleration) and that he never stops)

Another solution is to make a fake counter that just adds for example 1 unit for each second (that would not be real distance but user wont know that)

Well to add on that you can also count unreal units. Just check your current position, compare it against the last one (which you will have to save. You also might want to remove Z here) and take the distance between those and add that to a variable which saves the distance traveled.

Thanks for the help!!
I will try it, but at least I know how tto do it now :slight_smile: Great thanks for the help :slight_smile: