UNITY: Hanging Debris


In one of my games, I had destructible buildings, which would break into debris chunks. However the object full of debris chunks would be kinematic and not affected by physics at first. As each of these objects received a DoCollision() message, they were then knocked and would be affected by gravity/physics. The debris would then ask its neighbours and would query them to see if it either had no linking neighbours at all, or if the support below the debris had been removed to a certain threshold and would then collapse more of the building. The parent object that would swap the model out for the debris would create the initial neighbour links and surface information.

This gave buildings a very realistic crumbling effect as you smashed through them.


Link to Pastebin of source can be found here -> http://pastebin.com/PyKJJKk4.