1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Implemented Sorting by distance to locatable

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

  1. Fontkodo

    Joined:
    Jun 21, 2014
    Messages:
    350
    Likes Received:
    111
    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 Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    I implemented it, but should it be sortByDistanceTo or sortByDistanceFrom?
     
    Fontkodo likes this.
  3. Fontkodo

    Joined:
    Jun 21, 2014
    Messages:
    350
    Likes Received:
    111
    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 Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    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...