Hi folks,
Maybe you remember my old “destroyable buildings” project, the one of the collapsing tower and version 2, which is more adapted for breaking pieces out of a larger object…
Yesterday I started reworking the whole project, I took the tower from version 1 and improved it a bit, I rewrote the complex, 3 pages long script from version 2 and here it is: Destroyable Buildings v3
The whole code is only a few lines long, but it’s better than all the previous versions. You can simply set what objects automatically collapse when one object is hit, you can set single breakforces for every single object in scene and the objects can break into pieces or replaced by some other object.
I’ll keep working on this, maybe I’m gonna add some new features too, like some auto-setup thing or let the pieces be inflamable and sensitive to normal raycasting too (that got kinda lost in version 2 3)…
If you have any more suggestions to make or cool ideas for the next version, just post them here.
Okay, I’m trying, but I’ll have to reuse some elements from version 2 (which was better for modern architecture). I guess writing several unique scripts for different uses would be a good thing.
For the moment, the newest version includes flamable pieces, static-to-dynamic switch and hitpoints. I think you don’t even need joints anymore, just put rigidbody on your pieces and I’ll rework that in my code. A master-code to automatically add rigidbody and adjust correct weight for every single piece will come too. This could save you some of your time, plus I could add some elements to reduce performance cost and maybe I’ll have to put in collision sounds, etc…
If you have any more useful ideas, please tell me!
(ps: Wow, I’m thinking of some kind of in-editor level generator, but which lets you destroy every single structure of the game, no matter if it’s a wall, a tower or any other building :shock: Now, THAT would be awesome)
(ps2: Okay, I’ll just focus on improviing destroyable buildings first)
Well, the reason is that I didn’t make one yet
But you can just download the .unitypackage and try it out yourself… The whole package is only 2 Mb, so that I don’t see a real problem in downloading it…
thanks men
hey would you be interest in doing some
destryable cars and spaceships?
i need them for my game
ill give you credits
and if you want
profits of the game
att.: rudak
Well, just put together a construction, tower or whatever you want, add rigidbody to the pieces and attach the included script to every single piece. The script is quite easy to use: if you want the pieces to be flamable, just put some fire particle effect into the “flames” variable, if it should be replaced by smaller pieces, assign your prefab as “broken”. “maxForce” indicates how heavy a collision must be to let this piece collapse. hitPoints regulate how long something burns and how much regular damage it can take before collapsing/breaking apart.
“connectedTo” is the most important variable, it indicates which other breakable parts (who have the same script attached to them) are connected to this object and who’s stability is therefore depending on the selected object. If you break this piece, which other pieces should collapse as a reaction to this…
Sorry, I didn’t work on it in the last 2 weeks… But with only a few little changes, this could easily be done. For example by deleting the thing with rigidbody and joints and adding rigidbody and colliders only after the impact…
Hi, sorry for the late reply, but I honestly completely forgot about this project lately
I think I’ll just rewrite all of the codes, 'cause version 3 is kind of a mess. Too many scripts and much to difficult setup, etc…