I’m kind of lost what would be the most sensible way to approach this problem:
I have a mass of blocks, coming down from the ceiling. If some of the blocks are destroyed, the blocks no-longer connected to the main mass would fall. Kind of like bubbles in some bubble shooter, or falling minecraft blocks.
The biggest hurdle is reliably check if the blocks are connected to a path that connects to the ceiling.
I was considering of creating hinge joints between all adjacent objects (that are within a trigger collider or raycast range), but was told it would be a poor solution.
I could manually create joints between appropriate blocks, but the intention is to have different shaped masses, so it would be smarter to get it done through code.
Any suggestions how to readily start approaching this issue?
You could solve this by applying the “adjacency list” pattern. Every box has a list of each box it is adjacent to. It could take a while to setup, depending on the quantity of boxes. You can then use OnDestroy
Unity message to alert its neighbors as to when it has been destroyed.