So, I have a grid and you can build fixed size walls in that grid. I’m using simple onTriggerEnter/onTriggerExit to determine where I can/can’t build walls. Now the problem was, onTriggerEnter is also fired off when the objects just touched, so I could not build adjacent walls. I fixed that by setting the collider size to 99% of the mesh in all dimensions. The meshes could touch, but not overlap (as the grid is larger than the 1% difference).
Now, I’m trying to set up a way to merge my wall meshes to get a performance boost down the line. The simplest way would be to just merge everything that is touching… but because of the above mentioned 99% sized collider box, technically, nothing in the grid ever touches.
I thought about calculating distance and comparing to object size, but you can build in all 3 dimensions and you can modify the size of your construction piece in all 3 dimensions, so everything’s irregular and checking against every other thing in the scene (and I’m thinking of hundreds/thousands of pieces down the line) would be a pain.
So the problem in a sentence: how do I tell the difference from when two colliders are actually inside each other and from when they just share a few surface coordinates? That’s the minor issue though. The major issue is merging meshes that are close by each other. If not with collision, how else would I go about doing that? I’m not asking for code here, just give me ideas what to do, and I’ll try to work it out.