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:
    88
    Likes Received:
    10
    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 I'm your motherfucking conscience

    Joined:
    Nov 17, 2014
    Messages:
    3,197
    Likes Received:
    1,276
    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:
    88
    Likes Received:
    10
    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

    SlashnHax The Chosen One

    Joined:
    Dec 10, 2014
    Messages:
    2,957
    Likes Received:
    864
    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 The better executive ;)

    Joined:
    Dec 3, 2013
    Messages:
    3,440
    Likes Received:
    702
    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. Masonfletch

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

    Joined:
    Jan 25, 2015
    Messages:
    88
    Likes Received:
    10
    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...