I have a set of cubes, each parented to the cube in the center. I'm looking for a way to tell if one cube is connected (by touch) to the center cube, but through the cubes between them. If there's a gap between the said cube and its parent, it de-parents itself. Any other cubes that weren't connected to the parent, but were connected to said cube, re-parent to said cube.
On a smaller scale, let's say there's a stack of just 3 cubes (red is parent):
The top cube is connected to the parent via the center cube. But when the center cube disappears, the top is no longer connected, and needs to be de-parented. Otherwise it just floats there.
What would be the best way to detect collision through a series of other objects? I'd really appreciate any help.