Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Implemented Sorting by distance to locatable

Joined
Jun 21, 2014
Messages
350
We have an option to sort gameobjects by distance to the player via .sortByDistance, however there doesn't seem to be an option to sort by distance to another locatable.

So we could do something like:

Code:
GameObjects.newQuery().names("Granite rocks").results().sortByDistanceTo(new Coordinate(x ,y, z)).limit(0, 2);

This would allow us to save a bit of work trying to figure out how to manually sort by distance to a locatable.

@Cloud
 
Joined
Jun 21, 2014
Messages
350
I implemented it, but should it be sortByDistanceTo or sortByDistanceFrom?
We already have nearestTo(), so to keep things routine I would say SortByDistanceTo, but 'From' appears to be the more accurate term when it comes to the dictionary. It's up to you.
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
I think I'm going to use the word from because sortByDistanceFrom sounds better (and the reason we use the word to elsewhere is because nearestTo sounds much better than nearestFrom lol)
 
Top