Implemented Sorting by distance to locatable

Discussion in 'Client & Site Suggestions' started by Furor, Mar 14, 2015.

  1. Furor

    Joined:
    Jun 21, 2014
    Messages:
    344
    Likes Received:
    102
    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 (Text):
    1. 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
     
  2. Cloud

    Cloud The Developer

    Joined:
    Jul 28, 2013
    Messages:
    2,379
    Likes Received:
    785
    I implemented it, but should it be sortByDistanceTo or sortByDistanceFrom?
     
    Furor likes this.
  3. Furor

    Joined:
    Jun 21, 2014
    Messages:
    344
    Likes Received:
    102
    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.
     
  4. Cloud

    Cloud The Developer

    Joined:
    Jul 28, 2013
    Messages:
    2,379
    Likes Received:
    785
    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)
     

Share This Page

Loading...