1, 2, and 3: Change scenes. 1 is a 3-layer tower, 2 is a tall, skinny tower and 3 is a little dude standing next to a wall.
You can drag the mouse around to change where the "missiles" fly from. Once you press space to launch a missile, the mouse will start to control the camera instead!
Once a missile is flying, press E to cause an Explosion! All the block around any spawned missiles will get sent flying back!
You can spawn as many missiles and cause as many explosions as you want. Go crazy! Once you change scenes, everything will be reset.
There are a couple ways you could model explosions. You could simply set the velocity of nearby rigid bodies, but that might not be consistent if there are a lot of moving parts. I chose to apply an instant force to all objects caught in the explosion.
To do this, we take the vector FROM the bomb TO every rigid body in the scene. Then, we normalize it, and set its magnitude so that close-by bodies are affected more by the explosion.
Then, we tell each rigid body an instantaneous force to apply to the next frame! Notice that since the force needs to be in the local space of the rigid body, we multiply the inverse of its E matrix to go from world space to local space. Neat!