# Calculating Player position based on another Actor?

Hey all, I’m developing a “racing” game where there will be hundreds of players. It’s not a traditional racing game in the sense that there is a linear track. There will not be a track, rather, there will be a location that everyone is racing toward. I would like to be able to create a scoreboard that shows player positions (1st, 2nd, 3rd place, etc.) in relationship to the object that they are moving toward. In the video below you can see all of my blue/white balls are attracted to the sphere.

How would I go about recording which player (ball) is closest to the giant sphere? I can think of the basic idea but have no clue how to get started in Blueprints. I’m assuming it’s something along the lines of; Get world location of giant sphere. Get the world location of each player. Subtract the world location of the players to the giant sphere and whatever players world location value is closest to 0,0,0 is in first? Would I need to set up a timer on a tick to calculate every frame? How would I take this information and then translate it into a scoreboard?

What would your method be for doing this? Thanks!

UPDATE:
I’ve created an array and a series of separate nodes off of my tick to understand what’s happening. However, I’m struggling to figure out how to take this data and sort it as a scoreboard within a widget. Any suggestions?

You can sort an array by this approach

Or you can use a free UE extension LE Extended Standard Library in - UE Marketplace