For some context, I’m working on a game sort of like Minecraft. However, every cubic “block” follows dynamic physics and can be moved around by the player and other forces.
When running large chunks of terrain, this idea in practice would pretty much melt any computer. To help avoid this problem, I intend that whenever a 2x2x2 mass of similar cubes forms, the game would replace them with a single scaled up cube of the same material.
Here’s what I’m picturing:

I’ve tried for many hours implementing this through Raycasting each direction from a certain cube and offsetting the origin to check for the cubes on the opposite side. That method always gets so complicated near the end that my code is unreadable, plus, it simply isn’t practical given how fast the code needs to run.
How would you elegantly detect a 2x2x2 mass of cubes of the same scale carrying the same tag? Also, how many physics based objects can Unity handle? (Wondering if a tech demo would even be possible)
I’m using Unity’s Visual Scripting but understand C# enough to where I can probably translate your answers from C# over to Bolt.
Thank you so much for your help!
Should I use plane objects for the rendered sides of cubes and for collision? Also, with the dynamic physics, how could I apply that with this method? Great idea for spawning terrain as the player mines downward and replacing the tag system with a list, will definitely keep those in mind. Thank you so much for the help WintersBane!
– MegaManTwo2