|Press any key to restart with different random starting position. Yes, that's as interactive as it gets!
A few points of note:
- The mesh is dynamically broken into parts at runtime. Because this is a random process, it sometimes results in odd-shaped pieces which don't look very good.
- Particle effects are created in response to collisions between objects. If a lot of collisions occur, it can get very slow. There really should be some kind of limiter to keep things under control.
- Apparently the deferred explosion code causes the breakup time to vary quite a lot on slower computers. This might mean that the ship touches the ground before exploding. It's supposed to explode in the air!
- The ground is made out of three pieces: a visible mesh, a solid box collider a short way below the surface, and a trigger between the two. The trigger is used to increase the drag of objects which fall into it, in an attempt to simulate the effect of a large object ploughing into the deep dust of a moon's surface.
- There's no sound, because it's in space, right? Not that this explains the shockwave....
- The code has an exciting mixture of good, generalised design and random hardcoded values. The latter is a consequence of making changes just before the deadline.
- I made this specifically for this contest, using material from my game Phoenix Final (and a texture from Rescue). The plan is that this explosion effect will be rolled back into Phoenix Final to replace the pretty basic effect that's there at the moment.
You can download the Unity project here. All source code in the project is subject to the zlib/libpng License, which allows for it to be reused in your own projects or modified to suit your own needs. Please do not use the spaceship model or the asteroid textures without permission.