Always wanted to try making exploding meshes, finally had time for a small test version..
Info
– Shortcut to easy mesh (fake) destruction: Take each face, Create small 3D mesh piece for it (extrude/add vertice(s) backwards from face normal), Add rigidbody, Done!
– Used this code for slowly fading out the sleeping rigidbody pieces
TODO:
– Add some randomness to piece sizes/count? (now it gets slow if you explode the default sphere..too many faces)
– Add tangents, so can use normal maps (UV’s are already taken from source object)
– Add some option or fixed mat/color(?) for UV mapping the cut side..
– Adjust extrude size calculation (so that you could automatically split the already broken pieces..but not enough faces?, so just explode it to particles..)
– Make some building or wall to explode? (but must be invidual pieces..and gets difficult if should remove parts from original mesh instead)
– Add explosion force to hit position?
Webplayer:
http://unitycoder.com/upload/demos/MeshExploderUnity/
—
// now free at: (link coming soon)
– Same as demoscene, just not all the textures are included
– Not much comments or instructions..see demo scene how it works
– Warning! It will not work well with different shapes!! Default cubes are best (or low poly sphere, not the default unity sphere)
– Sample sphere fbx model included (as in demo scene)
– UV mapping is not perfect on the exploded piece back side..
– at line 80: float extrudeSize is the mesh piece size which is created
– Download link arrives to your email automatically
—
hey well done, works great!
Reply
that demo looks spectacular and I’m in awe of your programming skills
what physics and material settings do you use to keep your stacked objects stable?
whenever I try stacked objects they seem to jiggle and occasionally vibrate off of each other
Reply
Do you mean before breaking the objects?
(solver iteration is 20 on this one, default is 6, but actually that seems to work also..)
those boxes on the background are instantiated on Start(), with 0.03 y-offset..
Reply
would you mind sharing what the other physics settings are? Also what are the settings for the material the blocks are made out of?
BTW has this mesh exploder code been added to the asset store? Just the demo there is superior to the other mesh exploders available.
Reply
Everything is on default settings:
Rigidbody settings are also on defaults:
Mass: 1, Drag: 0, Angular: 0.05, [x] Use gravity, [ ] is kinematic, Interpolate: None, Collision: Discrete.
Using default boxes, box collider (no physics material assigned)
Project physics settings are also defaults:
Bounce: 2, Sleep vel: 0.15, Sleep ang. 0.14, Max ang:7, Min penetr.: 0.01, Solver: 6 (was 20 but both work)
(If you want to post your problem scene or object or settings, i can test it)
*not yet in assetstore, but i’ll try post it there eventually, still it wont work well with complicated mesh shapes..
Reply
In looking over the unity answers and some googlefu it looks like its a Unity issue with objects stacked more than around 12 high.
You can probably reproduce the problem if you make your towers 20 blocks high.
Reply
Yes, tested it: with 20 blocks height,
it starts to jump/fall down, even if solver iterations are at 100..
Reply
dynamic fracture system that can be readily used with Unity cubes only (free lite)
https://www.assetstore.unity3d.com/#!/content/7193?aid=1101lGti
Reply
Dynamic 2D Destruction:
http://forum.unity3d.com/threads/235005-Dynamic-2D-Destruction!!!
Reply
Boolean Mesh Project (sources)
http://forum.unity3d.com/threads/227196-Boolean-Mesh-Project
Reply
Delaunay – Voronoi Diagram library for Unity:
http://forum.unity3d.com/threads/248962-Delaunay-Voronoi-Diagram-library-for-Unity
Reply
Unity Debris System (should have free version, didnt find the download link though..)
http://forum.unity3d.com/threads/free-uds-destruction-in-unity.220905/
Reply
Breaking Glass – Unity C# Tutorial (with premade broken glass model)
Reply
this would be nice: voronoi shattering
http://jaketastic.com/blog/voronoi-shattering-complete/
Reply
[Free] Mesh Splitter
https://github.com/artnas/Unity-PMS
Reply
open-source script to destroy objects realistically in Unity3D
https://github.com/williambl/unity-destruction
Reply