Welcome!

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

Sign up now!

Question Verifying if an GameObject is reachable

Joined
Jan 25, 2015
Messages
121
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!
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
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.
 
Joined
Jan 25, 2015
Messages
121
you can call Coordinate#isReachable()

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?
 
Joined
Dec 10, 2014
Messages
3,255
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.
 
Author of MaxiBots
Joined
Dec 3, 2013
Messages
6,775
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.
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.
 
Joined
Jan 25, 2015
Messages
121
Simply isReachable might not work because it only returns true if you can walk to that coordinate and stand on it.

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! :)
 
Top