Destruction - Chunk Support Simulation; Need help with the logic/maths

Hey!

Right now I’m working on a simplified destruction system - made up of cube chunks. I’ve got the basic destruction in and chunks that are above the destroyed chunks will attach and simulate physics - effectively being removed from the main structure.

The problem I have right now is the logic behind checking each of the chunks to check if they have at least 1 chunk supporting it from falling (Physics being enabled and marking as detached).

I’m wondering if you guys could help me with the logic/math behind this?

SOO!

The way I’ve set it up is

A chunk starts as being attached to a building, each chunk has an X, Y and Z integer which determines its location.
Once a chunk is destroyed, all the chunks in the building are checked if they have a chunk adjacent (Then all those chunks need to be checked for adjacent chunks too).

To search the chunks, I add or minus part of the integer to see if the chunk exists and if it not detached/destroyed from the building. If no suitable chunks can be found as a support I will enable physics on that chunk and set it as detached.

Can anyone help me with the logic? I’m stuck and can’t seem to find a solution.

Here’s a few screenshots of the blueprints.

The Main Blueprint function

The Blueprint function to check the supporting chunks

Thanks!