Im using godot to make a rougelite game. A level is built with many programmed rooms.
Rooms should not overlap with each other, so i set area3d for each room. If a room is trying to connect with another, it will see if it is overlapping with another area3d.
Unfortunately, area3d.has_overlapping_areas() only work when physical system is running. This means it can work well in the real game, but not in the editor.When in the editor, it always return false.
I want to get a quick overview in the editor to iterate my game.So how can I know if two area3d overlap in the editor?
By the way, in my opinion, a room can only be generalize by polygon, because a room’s outline shape can be complex. I donnot think aabb or voxel is suitable.
In fact, some of my rooms are concaver, their shapes are provided by the CollisionPolygon3D. I am not sure if convex plane test will work. I’ll test it later.
And the aabb.Some of the room’s walls may not align to the axis.in this case, the axis-aligned bounding box is not suitble. Imagine that a door is attached to a wall which is not aligned to any axis, if two rooms are connect by this door, won’t their aabbs always be overlapping?And this is why I am sticking to the Area3D overlapping test or something else, but not aabb.
You dont use the AABB for the final overlap test. You use the AABB to avoid doing any calculations between rooms that are so far away from each other that it is impossible for them to ever overlap. You always do the more detailed tests later if the first AABB test succeeds.
If you have very complex and overdetailed shapes you might as well have multiple layers of AABBs to speed up the processing. E.g. the engine often has an AABB for a group of triangles or even every triangle.
A concave shape is just multiple convex shapes squished into a single shape resource for convenience. They are always converted to convex shapes behind the scene. That is also how the physics engine processes them.
Often procedual placements like this are also build around tiles and grids. When you rasterize your shapes into cells you can immediately tell if something overlaps because then the cell will be already occupied. Same as you can tell with a plane test if a shape edge is on the wrong plane side it overlaps.