How to detect when two colliding objects create a corner?

96538-walls-corner.jpg

Well if you look at the screenshot, I would need that corner to look more like a corner, my idea is to be able to make walls dynamically in game time but without using connectors like the posts of a fence, looking more like a smooth wall. The wall is composed of 3 parts, the two faces that are seen and an upper face for a perspective view, would have a total of 3 planes. I try to detect the face that collides with the panel collider but the script does not work very well. It does not do what I need technically.
The idea is that, when I can detect the corner, I can decide what to do with that information. In any case could replace the affected models to close the corner. Also could apply another type of solution, the problem is that, I do not know how to detect that these two objects create a corner.

Edit:
alt text

Well, studying the grid topic a little, I realized that this was not going to be useful so I completely redo it. Now each vertex of the grid, each point, is formed by a gameobject which can store information. So far I can say that I store a wall and the points to which it connects. Even so I was thinking that this became very tedious and I do not think it will be useful either, so before going any further, I would like you to give me some tips on this. My idea was that each connected point provides information on whether it has a wall or not and to which points that other point is connected, to know if a corner is created or not. Then I found the possibility of adding another type of wall, such as a fence, but I thought, if the wall was not a wall, and this was a fence, and this was between two walls, I would know if it is a wall or If it is actually a fence. Then I came up with the possibility of adding sub-grids where the walls would really be stored, and I found that I would need a total of 4 grids, one to navigate the poles that create the walls, another 2 for the walls, and another For objects that I will add as a box or barrel, etc. And this leads me to not know if what I’m doing is fine or if I’m complicating it more than it really should be.

Well, let’s see @Ancard, what could be the easiest way to do this? One suggestion I have is putt Raycast from Top left corner of front wall (I am taking this pic as reference to explain my point) , going all the way down along the edge. And the second Raycast from top right corner of the other wall going all the way down the egde. When the raycast detect a collision, you will know it has formed a corner. This may not be very convincing but it’s just a thought. Try to implement it.