Is possible to evaluate through an Area2D whether a region is navigable or not?

Godot Version

4.2

Question

Hello, my question is whether it is possible to evaluate through an Area2D whether a region is navigable or not? (navigation through a "NavigationRegion2D).

Context:
I am creating an isometric rts building system. Currently I have a system where when selecting a building it sends an id and a size (vector2) to the tilemap. The ID received is to set the scene loaded in the tilemap atlas. While I use vector2 so that an Area2D takes the size of the building. I use Area2D to: 1. have the size of the building visible. 2. so that if it touches another area it does not allow itself to be planted.

Problem: The Area2D is bugged and stops invalidating in some cases where you enter and exit too quickly between buildings.

My possible solution is to evaluate, in addition to whether the area is occupied, if this area is navigable.

Not directly because the physics engine and the navigation system are unrelated.

The only query friendly structure in this situation for a Rect check seem to be the TileMap because it operates on a grid while both physics and navigation don’t. I would check the TileMap cells inside the Rect if they have a placed polygon.

The NavigationServer has the navigation mesh combined freeform so doing Rect checks like that is not really viable and there is also no API to do it.

1 Like