2
2013
Poor man’s Mesh Exploder
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
—
Image#2: Using cubes
<-click to view
Related Posts
17 Comments + Add Comment
Leave a comment
Recent posts
- MotionVector Effect: Object “disappears” when paused
- [GreaseMonkey] Unity Forum Fixer
- UnityHub: Make Hub application background Translucent
- Customize SpriteShapeRenderer quality (but has issues)
- Editor tool: Copy selected gameobject’s names into clipboard as rows (for Excel)
- Editor tool: Replace string in selected gameobject’s names
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
Recent Comments
- [Asset Store] Point Cloud Viewer & Tools on
- [Asset Store] Point Cloud Viewer & Tools on
- Vector3 maths for dummies! on
- UnityHub: Make Hub application background Translucent on
- UnityHub: Make Hub application background Translucent on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- [Asset Store] Point Cloud Viewer & Tools on
hey well done, works great!
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
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..
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.
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..
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.
Yes, tested it: with 20 blocks height,
it starts to jump/fall down, even if solver iterations are at 100..
dynamic fracture system that can be readily used with Unity cubes only (free lite)
https://www.assetstore.unity3d.com/#!/content/7193?aid=1101lGti
Dynamic 2D Destruction:
http://forum.unity3d.com/threads/235005-Dynamic-2D-Destruction!!!
Boolean Mesh Project (sources)
http://forum.unity3d.com/threads/227196-Boolean-Mesh-Project
Delaunay – Voronoi Diagram library for Unity:
http://forum.unity3d.com/threads/248962-Delaunay-Voronoi-Diagram-library-for-Unity
Unity Debris System (should have free version, didnt find the download link though..)
http://forum.unity3d.com/threads/free-uds-destruction-in-unity.220905/
Breaking Glass – Unity C# Tutorial (with premade broken glass model)
this would be nice: voronoi shattering
http://jaketastic.com/blog/voronoi-shattering-complete/
[Free] Mesh Splitter
https://github.com/artnas/Unity-PMS
[…] Uploaded sources for the old mesh exploder project https://unitycoder.com/blog/2013/08/02/poor-mans-mesh-exploder/ […]
open-source script to destroy objects realistically in Unity3D
https://github.com/williambl/unity-destruction