Guys, I'm newbie and I have a problem that I can not solve yet. Please see attached img to get understand my issue.
I have a Family of objects - different boxes. I need to find the box nearest to the ship, but I have to take into account only those boxes that are at the fixed distance to the player.
I can easily find the nearest box without taking into account the distance to the player by Pick nearest to target.X, target.Y. But there is a problem with linking it to the distance to the player.
Perhaps I need to make an array of boxes that are at the desired distance to the player and then run through this array to compare the distance from each box to the target to find the closest one?
How to implement this algorithm?