{"id":2103,"date":"2013-08-02T06:34:35","date_gmt":"2013-08-02T03:34:35","guid":{"rendered":"http:\/\/unitycoder.com\/blog\/?p=2103"},"modified":"2017-02-20T13:28:07","modified_gmt":"2017-02-20T05:28:07","slug":"poor-mans-mesh-exploder","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2013\/08\/02\/poor-mans-mesh-exploder\/","title":{"rendered":"Poor man&#8217;s Mesh Exploder"},"content":{"rendered":"<p><a title=\"start webplayer demo\" href=\"http:\/\/unitycoder.com\/upload\/demos\/MeshExploderUnity\/\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2104\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2013\/08\/02\/poor-mans-mesh-exploder\/poor_mans_mesh_exploder_unity_1\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_unity_1.jpg?fit=680%2C544&amp;ssl=1\" data-orig-size=\"680,544\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"poor_mans_mesh_exploder_unity_1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_unity_1.jpg?fit=680%2C544&amp;ssl=1\" class=\"alignnone size-full wp-image-2104\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_unity_1.jpg?resize=680%2C544\" alt=\"poor_mans_mesh_exploder_unity_1\" width=\"680\" height=\"544\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_unity_1.jpg?w=680&amp;ssl=1 680w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_unity_1.jpg?resize=300%2C240&amp;ssl=1 300w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_unity_1.jpg?resize=200%2C160&amp;ssl=1 200w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/a><\/p>\n<p>Always wanted to try making exploding meshes, finally had time for a small test version..<\/p>\n<p><strong>Info<\/strong><br \/>\n&#8211; 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!<br \/>\n&#8211; Used <a title=\"http:\/\/forum.unity3d.com\/threads\/4723-fade-in-and-fade-out-of-a-gameobject?p=43586&amp;viewfull=1#post43586\" href=\"http:\/\/forum.unity3d.com\/threads\/4723-fade-in-and-fade-out-of-a-gameobject?p=43586&amp;viewfull=1#post43586\" target=\"_blank\">this code for slowly fading out<\/a> the sleeping rigidbody pieces<\/p>\n<p><strong>TODO:<\/strong><br \/>\n&#8211; Add some randomness to piece sizes\/count? (now it gets slow if you explode the default sphere..too many faces)<br \/>\n&#8211; Add tangents, so can use normal maps (UV&#8217;s are already taken from source object)<br \/>\n&#8211; Add some option or fixed mat\/color(?) for UV mapping the cut side..<br \/>\n&#8211; Adjust extrude size calculation (so that you could automatically split the already broken pieces..but not enough faces?, so just explode it to particles..)<br \/>\n&#8211; Make some building or wall to explode? (but must be invidual pieces..and gets difficult if should remove parts from original mesh instead)<br \/>\n&#8211; Add explosion force to hit position?<\/p>\n<p><strong>Webplayer:<\/strong><br \/>\n<a title=\"http:\/\/unitycoder.com\/upload\/demos\/MeshExploderUnity\/\" href=\"http:\/\/unitycoder.com\/upload\/demos\/MeshExploderUnity\/\" target=\"_blank\"> http:\/\/unitycoder.com\/upload\/demos\/MeshExploderUnity\/<\/a><\/p>\n<p>&#8212;<\/p>\n<p><strong>\/\/ now free at: (link coming soon)<br \/>\n<\/strong><\/p>\n<p>&#8211; Same as demoscene, just not all the textures are included<br \/>\n&#8211; Not much comments or instructions..see demo scene how it works<br \/>\n&#8211; Warning! It will not work well with different shapes!! Default cubes are best (or low poly sphere, not the default unity sphere)<br \/>\n&#8211; Sample sphere fbx model included (as in demo scene)<br \/>\n&#8211; UV mapping is not perfect on the exploded piece back side..<br \/>\n&#8211; at line 80: float extrudeSize is the mesh piece size which is created<br \/>\n&#8211; Download link arrives to your email automatically<\/p>\n<p>&#8212;<\/p>\n<p><strong>Image#2:<\/strong> Using cubes<br \/>\n<a href=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_cubes_unity_1.jpg\" target=\"_blank\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"2107\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2013\/08\/02\/poor-mans-mesh-exploder\/poor_mans_mesh_exploder_cubes_unity_1\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_cubes_unity_1.jpg?fit=797%2C644&amp;ssl=1\" data-orig-size=\"797,644\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"poor_mans_mesh_exploder_cubes_unity_1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_cubes_unity_1.jpg?fit=797%2C644&amp;ssl=1\" class=\"alignnone size-medium wp-image-2107\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_cubes_unity_1-300x242.jpg?resize=300%2C242\" alt=\"poor_mans_mesh_exploder_cubes_unity_1\" width=\"300\" height=\"242\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_cubes_unity_1.jpg?resize=300%2C242&amp;ssl=1 300w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_cubes_unity_1.jpg?resize=200%2C160&amp;ssl=1 200w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_cubes_unity_1.jpg?w=797&amp;ssl=1 797w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>&lt;-click to view<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Always wanted to try making exploding meshes, finally had time for a small test version.. Info &#8211; 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! &#8211; Used this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2104,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[4,3],"tags":[402,522,520,523,519,5,521,6],"class_list":["post-2103","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-demos","category-unity3d","tag-asset","tag-boolean","tag-destroy","tag-destructible","tag-explode","tag-mesh","tag-pieces","tag-slice"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2013\/08\/poor_mans_mesh_exploder_unity_1.jpg?fit=680%2C544&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-xV","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/comments?post=2103"}],"version-history":[{"count":12,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2103\/revisions"}],"predecessor-version":[{"id":4510,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/2103\/revisions\/4510"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/2104"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=2103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=2103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=2103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}