By: David Rhodes
Recalling city destruction arcade games from my childhood, I wanted to see how quickly I could build a destructible game environment using real-world city data in Unity.
Creating individual GameObjects and mesh colliders for each building is simple — check out this tutorial. We can also apply random materials to each building for texture variation. All of these assignments are done using the Map Factory Framework, which you can visualize in the new Map Editor.
For building destruction, I remembered a fantastic presentation by Richard Fine. In this presentation, Richard used scriptable objects to create intricate destruction sequences, complete with animation, camera shake, sound effects, and particle systems. I pulled his example repository assets into my project and assigned a Destructible component to each building, also done through the Map Factory Framework.
Other notable additions:
- Imported Unity’s post-processing stack to add some visual flair
- Added a RigidBody component to the Kaiju to detect collisions with building colliders
- Implemented a tap-to-move system using Unity’s built-in navigation components
Given the ease of ARKit integration in Unity, I thought it would be fun to turn the player into Kaiju. To do so, I simply imported Unity’s ARKit plugin and constrained the Kaiju to the AR-enabled camera. Now, you can destroy buildings just by walking!
Thanks to the modularity of our Maps SDK for Unity and the ease of prototyping in Unity, I built a proof of concept for my new game in just four hours! What will you build?
Destroying a virtual city with my Kaiju was originally published in Points of interest on Medium, where people are continuing the conversation by highlighting and responding to this story.