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

Question Verifying if an GameObject is reachable

Discussion in 'Developer Support' started by LucasSousa, Feb 29, 2016.

Tags:
  1. LucasSousa

    Joined:
    Jan 25, 2015
    Messages:
    121
    Likes Received:
    19
    Has any resource from API or by yourself (a method or class) to help verify if a GameObject (like a tree, a door, a rock...) is currently reachable - if the object can be "touched" by the user?

    Thanks in advance for support!
     
  2. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    If the object can be touched is not part of the API.
    However, you can call Coordinate#isReachable(), which determines if the player can stand on the given coordinate, which you can use to implement your own method.
     
    LucasSousa likes this.
  3. LucasSousa

    Joined:
    Jan 25, 2015
    Messages:
    121
    Likes Received:
    19
    Yea, good! So, for example, if I need check if a stove, that is inside a small house blocked by a closed door, "is rechable" can I use that method for check if the nearest coordinate from it is reachable? In this cases we must to take in consideration the coordinator and not the object. I'm right?
     
  4. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    What you might want is finding if the surroundings are reachable. There's a surroundingsReachable() method in the GameObject query builder, or you can do getArea().getSurroundingCoordinates() and then find if any of those are reachable. Simply isReachable might not work because it only returns true if you can walk to that coordinate and stand on it.
     
    LucasSousa likes this.
  5. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    This is exactly what i was going to say. surroundingsReachable checks if any of the coordinates around the objects area are reachable and reachable itself only checks if you can traverse that coordinate.
     
    LucasSousa likes this.
  6. Tektovak

    Joined:
    Feb 27, 2016
    Messages:
    47
    Likes Received:
    8
    I'll have to keep this in mind
     
  7. LucasSousa

    Joined:
    Jan 25, 2015
    Messages:
    121
    Likes Received:
    19
    So I think your solution will gonna work well for a situation like the my example. Now I'm just waiting for 4 gb ram to run the tests. Thanks for your answers! :)
     

Share This Page

Loading...