how can i get the closest actor to the player from an array of actors
(closest crystal to player from 100 crystals)
Basically do a get all actors of class ( get the world location ) and measure the distance between them with distance ( vector ).
But how often are you doing that? It’s not a cheap operation.
It would be better for each crystal to know it’s distance from the player.
What are you trying to achieve?
a compass that shows you the crystal nearest to you
You could change it to a sphere trace for crystals, that only crop up on the radar when they are within a certain distance… Then it really is a kind of radar
now thats something that i shouldve rthought of
thanks!