- Home /
Destructable Scenery
Is it possible to have scenery such as buildings, cars, windows etc. be destructable? For instance if I were to shoot a bazooka at a wall could I just shoot out that chunk of wall and how would i do that?
Answer by Statement · Dec 09, 2010 at 12:07 AM
A simple way of achieving this is having objects replace themselves with damage models after obtaining damage. That way you create different models for different "rubble" models of the same asset. Simply remove the original part and swap in a "rubble" part instead.
For your bazooka to crack that one piece of the wall requires the wall to be placed segmented.
There also are algorithms to procedurally break objects but those can be hard to get right. I think I saw a demo on a unity project using this but I don't remember which one. Anyhow, I think the best visual appeal for the time spent implementing the feature come from simple damage models. You can create a range of damage models if you want it to be other than just "fixed" and "b0rked". To have some variance you could have "random sets" of different representations of that model, so not every part of the wall would look the same after its blown up.
A simple script could have several children with different models, and show one model at a time depending on the damage level. So you could simply have an array of transforms on which game object you de/activate recursively.
To add special effects, you can use SendMessage when transitioning from one state to another, to call that models "OnExplosion" effect. Then you can separate the actual explosion effect from the rest of the code to have it flexible.
thats what i was thinking. for the most customization though that would take tons of models per building though wouldn't it? and say I want it to be like a car drives through and i want the wall to destroy where the wall was would that require one of these algorithms?
Yeah there are many different ways to do it. Basically try to think about how you want it to behave, and then try to think of the EASIEST way to achieve that.
do you know where i could learn more about these algorithms?
I hate to make another clich but... :/ http://www.google.se/search?q=procedural+demolition
You can always look at games that already have similar features (such as "Red Faction") and read their blogs et.c. I really hope whoever made that destruction demo for Unity posts here so you get a little more help from them.
Answer by Kos-Dvornik · Jan 05, 2015 at 05:23 PM
In addition to above try this tutorial: http://kostiantyn-dvornik.blogspot.com/2015/01/unity-anoxemia-destruction-tutorial.html
Your answer
Follow this Question
Related Questions
Creating 2d damagable terrain? 0 Answers
How to add terrain destruction 1 Answer
Damage Meter 1 Answer
How to have deformation/denting of 2D objects on impact? 1 Answer