A recent screenshot of the level. Shows the Unity terrain.

Destructible meshes, terrain and physics.

It’s been almost a year since I first started making Weaggles World War (the tank game), then there was a jam, then there was Winning Streak and then my summer job. For quite a while I had not opened this project, but last week I finally did and I started toying with it.

Unity 5 had broken a few things – some were easy to fix, others slightly less. The biggest problem I had (and still have) is that the collisions are now much more sensitive and sliding a box on a floor made up of boxes is not possible as it catches the edges of the boxes bellow (this problem). There probably is a workaround, but instead of fighting I just accepted it and decided to use a more interesting alternative – unity’s terrain. So, the old 3 levels are still there, but not very playable, and I’ll be making new ones using terrains. One handy trick that comes with height map based terrains is the ability to deform them at runtime, raise mountains or dig holes, make craters, etc  :)

I also tweaked a lot of physics and control settings. Tanks no longer move in set increments (no more ForceMode.VelocityChange or transform.rotation = X). Instead everything is internally controlled by forces, the way physics is meant to be.

I allowed crates to rotate freely on the map (not just the y axis as they used to) and with that I had to change the way the bouncy damage animation works (as they would jump on their local up axis… nothing drastic).  And last but not least – destructible meshes. Crates now will shatter when they take enough damage and spawn physical shards (which will disappear after a while). It just makes destruction so much more pleasing and makes you want to break a crate as soon as you see one ^_^.

A short gif video of destructible crate meshes.

Destruction! Yeah!

The shattering effect is not perfect as it’s a crate made of planks and the shards are irregularly shaped, but it does the job :)