Support Forum

Reverse how obstacles work


I am trying to figure out how to reverse the way the obstacle function works.

I have a tilemap and want to draw a line on it like the image below. But, I want the reverse to happen. I want the outside part to become the part that can’t be traveled. Basically, making the entire Astar grid non-traversable by default and only if it has a collider would it become traversable.

Not sure if that’s possible?


Thinking about this, I ended up creating an invisible tile with a tiny physics shape that will be missed by Astar’s raycast, filled the entire world with the invisible tiles, and then drew in my road/sidewalks on different layers. Then I added a 2nd graph to handle the two different layer masks for walking and driving.

Walkable path

Drivable path

Still curious if there’s an easier way without filling the entire world with invisible tiles.