Demo Man - Destroy Procedurally Generated Rigid Body-based Buildings(Requires Unity Webplayer to run)
|CS 4496 Computer Animation||Karen Liu||Spring 2013||Unity/C#||No||Code N/A|
This is another case of having a very limited time to implement something in Unity. In this case, I coded the procedurally-generated buildings in a bit over a day. Each building is built by a collection of cubes, each of which consists of walls connected by breakable joints to compound struts forming the edges of these cubes. These struts were also breakable into numerous component blocks. To facilitate performance, I put all the physics calculations on the cubes "To Sleep" initially, with a particular cube "waking up" only upon some force being detected on the breakable joint that was some percentage of the amount required to actually break the joint. This amount varied based on how high the particular cube was, with higher-floor cubes requiring less force to awaken than lower-floor cubes.
I was able to get some interesting "finite-element"-like behavior out of this simulation, where a particularly tall building could be made to pancake-collapse, with outside-wall supports sometimes remaining unbroken, only to have them collapse separately, in a spiraling motion.