Search Unity

Exploder [RELEASED]

Discussion in 'Assets and Asset Store' started by reindeer-games, Jul 12, 2013.

  1. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hello everyone,

    I would like to announce a new Unity3d package Exploder: Realtime mesh explosion system.

    $logo.jpg


    Exploder is an ultimate realtime mesh explosion system for Unity. It can explode any game object in a matter of milliseconds! Just tag your favorite game object and call methodExplode from the script. It comes with tons of settings and adjustments based on more than one year of community feedback.


    WebPlayer Demos:


    FPS Demo #1
    Click and Explode Demo #2











    FEATURES:
    • full source code included
    • 2 simple scenes for start
    • 1 complex FPS scene with three weapons
    • skinned mesh support
    • explode 2d sprites (tested with 2d toolkit)
    • 2D Physics support
    • works with UFPS camera
    • Playmaker support
    • vertex color support
    • example in JavaScript

    Available in Asset Store: LINK
     
    Last edited: Aug 19, 2014
    Gozdek likes this.
  2. imphenzia

    imphenzia

    Joined:
    Jun 28, 2011
    Posts:
    413
    Looks great, just had some fun blowing up stuff in the demo scenes and it worked a treat. Also seems like UV-mapping is taken into consideration nicely. I need this for an upcoming game so I'll be a likely customer soon!

    Great work!
     
  3. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    look great
     
  4. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Thanks for your interest!

    Yes, UV mapping and also Tangents are computed for the cutted mesh.
     
  5. w00dn

    w00dn

    Joined:
    Apr 28, 2010
    Posts:
    275
    Any chance of getting vertex colors to work on the shards? I've just purchased and forgot to think about it and ask here first. :p
     
  6. TOO-TIDY-STUDIOS

    TOO-TIDY-STUDIOS

    Joined:
    Feb 26, 2011
    Posts:
    139
    Just bought it and having a blast with it ;) One thing, usually the exploded object gets divided into bits, but sometimes it just stayes in one piece identical to the original (but as an fragment object) Is it scaling, import scaling or something like that confusing the divider algorithm?
     
  7. w00dn

    w00dn

    Joined:
    Apr 28, 2010
    Posts:
    275
    @operatio apps: I had that happening to meshes with holes. Once those holes were closed, it didn't happen anymore. Not sure if it was just a coincidence...
     
  8. TOO-TIDY-STUDIOS

    TOO-TIDY-STUDIOS

    Joined:
    Feb 26, 2011
    Posts:
    139
    @woodn, that was no coincidence, now it works correctly. Awesome, thanks. Do you also know anything about UV coordinates and texture in the cut planes?
     
    Last edited: Jul 13, 2013
  9. w00dn

    w00dn

    Joined:
    Apr 28, 2010
    Posts:
    275
    @Operatio Apps: Unfortunately, I don't.
     
  10. Hazard-Harry

    Hazard-Harry

    Joined:
    Mar 15, 2013
    Posts:
    2
    Does this only work for 3D models or could it work for 2D sprites?
     
  11. n8

    n8

    Joined:
    Mar 4, 2010
    Posts:
    147
    can't say for sure as I haven't purchased yet, but a sprite is just a quad with a texture on it so you should be to do the same thing to it as you would any other model.
     
  12. sguay

    sguay

    Joined:
    Nov 16, 2012
    Posts:
    1
    Hi,

    Just purchased this package and so far we are pretty impressed. We do have one question though and that concerns the 'Force' property and trying to reduce the "blast" of the explosion.

    It seems like anything below 10 and the blast seems to stay the same. For a couple of our scenarios, we need a much smaller force blast to happen. We've even tried 1.0, 0.1, 0.001, just to see what force and each of the pieces still get thrown pretty far. Basically we are looking for a scenario where say a Vase that just breaks into pieces and falls (maybe very very very light explosive force) but right now, we can only get the vase to explode as if we had a large piece of dynamite inside. :(
     
  13. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hello there,

    by vertex color on shards you mean to have one color on for all fragment pieces?

    Currently the cutting algorithm cuts the mesh and generates UV mapping for the cut-side and assign the same material from original object.
     
  14. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    The cutting algorithm looks for meshes in selected radius, meshes close to the center will be cut into more pieces than meshes far from the center. Like in real explosion. It is possible that your object was too far from the center and therefore it got assigned only one fragment piece.
     
  15. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi there,

    I have just tested with a plane in the "simple demo" and unfortunately it does not work properly, I will look for the solution today and make an update. I will keep you informed.
     
  16. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    yes I know about this, the reason is that I am using box colliders for fragment pieces. I decided for box colliders because of performance. Now when the mesh is cut into pieces and all pieces got assigned box collider it will "explode" regardless of small "Force" property because of their collision.

    The solution for you is to enable "Mesh colliders" (property of Exploder object). However as you probably know mesh colliders are much slower than box colliders. I would like to make some improvements in this area, ignoring collision for fragment pieces and/or compute mesh colliders by myself (convex hull).
     
  17. w00dn

    w00dn

    Joined:
    Apr 28, 2010
    Posts:
    275
    @reindeer games I was hoping to have it work much like the uv layout. predefined colors transfer and cross sections get assigned a definable color. I'm hoping to achieve the effect seen in the attached image. (the inner walls would be defined as an inner cube in the model and don't need to be generated)

    $box.jpg
     
  18. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Ok, I understand. You want a predefined color (material) for cross sections. Yes I can make it, it should be easy. I will make another script object with fragment options (material for cross section, also can be useful for another future options like sound effect ...). And you can assign this script to your object and when it breaks it will apply the settings.
     
  19. TOO-TIDY-STUDIOS

    TOO-TIDY-STUDIOS

    Joined:
    Feb 26, 2011
    Posts:
    139
    No, it was in center of the radius. So it looks like @woodn's solution was it - closing all holes in the mesh. We had holes on intersecting mesh-parts that where hidden by other mesh-parts. After closing them it fragmentet perfectly, before it did work only about 20% of the time.
     
  20. TOO-TIDY-STUDIOS

    TOO-TIDY-STUDIOS

    Joined:
    Feb 26, 2011
    Posts:
    139
    Assigning a material for cross section would be great! An additional option could be to use a UV-portion of the already applied material. E.g. set like UV(0,0,10,10). Would be useful on iOS to limit materials/textures, but also for keeping it faster to set up if you don't need spesific materials with other shaders.
     
    Last edited: Jul 14, 2013
  21. w00dn

    w00dn

    Joined:
    Apr 28, 2010
    Posts:
    275
    Hm, I would want the mesh to copy the vertex colors of the original mesh to the new meshes and assign a definable vertex color (like green in my example) to the cross sections vertex colors... If you know what i mean ;-) No unity-materials involved except the one i put on the whole mesh to interpret and recolor the vertex colors via editor. I understand that this is a bit specific...

    In another case, when used with textures, it would probably make sense to have another material and uv-coordinates assigned to the cross section or for a one-drawcall solution, better some predefined uv space in the current uv map as Operatio Apps suggested.
     
    Last edited: Jul 14, 2013
  22. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Looks bloody fantastic, great job...a for sure purchase!!

    "Blow'ed up Real Good!!!"
     
  23. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Ok, I know what you mean, I will look into that.
     
  24. w00dn

    w00dn

    Joined:
    Apr 28, 2010
    Posts:
    275
    Cool, thanks! :)
     
  25. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Looks fantastic! Definitely on my shopping list! :)
    BTW, just one question, have you tested this on mobile?
    What's the performance like?
     
  26. TOO-TIDY-STUDIOS

    TOO-TIDY-STUDIOS

    Joined:
    Feb 26, 2011
    Posts:
    139
    Excellent :)
     
  27. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    I just made a fix for 2d planes, now it will work with 2D sprites as well. Update will be out in a couple of days...

    Demonstration video:

    [video=youtube_share;PYgEkZki5pg]http://youtu.be/PYgEkZki5pg
     
  28. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi, thanks, I have tested this (simple demo) on my Android Galaxy s2 and it runs smoothly. Basically you can specify maximum time to spend on calculation per frame, so if you have a slower device it will just take more frames to process the explosion and you shouldn't notice any higher frame drop. The real performance killer is a number of fragments (rigid bodies) so my suggestion is to keep it lower on mobile devices. To minimize object creation overhead fragment pieces are living in a pool so once they are created they are recycled every explosion.
     
  29. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    A new version 1.0.7 has just been published in the Asset Store.

    I added ExploderOption script object with these options:

    $options.jpg

    If you attach this script component to your game object it will apply the settings for the explosion.

    Plane2D - check this on if you want to explode 2d plane (sprite)
    Cross Section Vertex Color - is a color for cross section, this is valid only for meshes with vertex color (and vertex color shader)
    Cross section UV - custom UV mapping for cross-section from original material, you can now select UV area from original material to use on cross-section

    Note that I haven't added custom cross-section material yet because I have run into performance problems with sub-meshes (needed for multiple materials). I will add this feature later, I just need more time to figure out the best way.

    If you have any problems or suggestions, please post it here.

    Thanks.
     
    Last edited: Jul 16, 2013
  30. w00dn

    w00dn

    Joined:
    Apr 28, 2010
    Posts:
    275
    Vertex colors now work great, thank you for the update!
     
  31. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    Looks great in the demo.
    Question :- can I control how many pieces the objects break into ? what if sometimes I want 2 pieces, and other times 20 ?

    How about cracking it, at a separate time from exploding it ?
     
    Last edited: Jul 17, 2013
  32. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi, there is a public variable "TargetFragments" that controls number of fragment pieces.

    The "crack and late explode" feature is not there currently. But it sounds like more people might be interested, I will add it to next update.

    Thanks.
     
  33. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    thanks much. Just bought it :)
     
  34. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi, the new version 1.0.8 is already in the Asset Store.

    I have added crack explode feature, please test it if it fits your needs, there are two new methods:

    Code (csharp):
    1.  
    2. public void Crack()
    3. public void ExplodeCracked()
    4.  
    You can also find an example in DemoClickExplode.cs.
     
  35. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    outstanding ! thanks much. I'm sure it will be great.
    I might not be able to test today, but will do by the weekend for sure.
    Thanks again
     
  36. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    Just made first integration, works great thanks :)
    My only comment... can I get a list of the debris returned to me when I explode something... exploding makes lots of debris objects, and I want to add scripts to them, so I can clean them up after X-time delay... or maybe to fade them out or destroy them, or maybe to add particle FX such as smoke to the parts.

    I think this is very useful functionality that most people will need.
    cheers
     
  37. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Great it works well for you.

    About the debris. All debris (fragments) are managed by FragmentPool class. It is a singleton with public access. Before the explosion FragmentPool allocates (creates) necessary number of fragments, for example 100 debris objects.

    And when you destroy something FragmentPool will give you list of pre-allocated fragments you need for explosion. When you run another explosion FragmentPool recycles old fragments and give you the same list, so the total number of fragment pieces is stable and there is no need for new object allocations. However if you need to destroy all fragments you can call

    Code (csharp):
    1.  
    2. public class FragmentPool
    3. public void DestroyFragments()
    4.  
    Also there is a public variable "VisibilityCheck" in ExploderObject you can set from inspector or code which basically deactivates all debris hidden from camera (but it does not destroy them).

    But yeah, I think I will add more functionality for fading out the debris, option for particles is also a good idea.
     
  38. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    cool. thanks. :)

    yes, people will need control of which fragments fade out at what time, maybe some will have fire trails, others will have smoke, some will have nothing special... some will not fade out, but some will fade out and delete themselves.

    so it sounds like I can use fragment pool for my list of debris ok, and manually add my own fade out code and particle FX, to new fragments.

    How do I turn off a fragment when I no longer need it in the scene, so that it is ready for the system to recycle it ? just use SetActive(false) ?

    cheers
     
    Last edited: Jul 19, 2013
  39. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Yes, you can use fragment pool to get the list of fragments. Also you can call SetActive(false) for each fragment, it will deactivate (hide) it and it will be ready for next explosion.

    I will make additional public API for people to work better with fragment pieces over the weekend.

    Cheers.
     
  40. reelsteve

    reelsteve

    Joined:
    Jul 19, 2013
    Posts:
    2
    Is there something which makes a "plane" game object different than the rest ? All of the other objects blow up as expected but planes stay in one peice and just bounce around. Being as I am 30% plane, with the largest second denomination being 15% puerto rican, I feel very ostracized watching my fellow game objects explode into a million pieces while I have to remain a lowly one. Would you try and figure out a way for me to explode ?!
    Many Thanks ! Awesome product.
     
  41. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hello there,

    there is an easy solution for you:

    Find ExploderOption script object and assign it to your plane, set Plane2D to True and you are done :).

    The main difference is that the plane is not a closed mesh (like a sphere or a box) so there is a slightly different calculation, that's why we have to mark the "plane" object. I think I forgot to update the documentation about it.

    Thanks for buying!
     
  42. bugrit

    bugrit

    Joined:
    Jul 20, 2013
    Posts:
    3
    Quick question about cracking. I had assumed that this would create a crumbling effect on an object but I'm guessing that it is just for pre-calculating an explosion's debris, is that correct?

    I am looking more for crumbling effect, i.e. no initial velocity on the debris. Is this possible in the current version? I tried toning down the Force variable but see no discernible different between the default 30 and 1.
     
  43. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    try setting very low force and turn on the mesh collider option, (instead of box colliders).
     
  44. bugrit

    bugrit

    Joined:
    Jul 20, 2013
    Posts:
    3
    I have tried changed all of the ExploderObject settings as well as use different meshes and colliders but I still get noticeable initial velocity on the debris.

    I'm just thinking about simulating shattering objects or just having an object fall apart (i.e. demolishing a building or something like that where the object doesn't fly apart but collapses).
     
  45. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hey,

    I just made a simple video with force set to 0 and enabled mesh colliders:

    [video=youtube_share;mFwmNfkTdrU]http://youtu.be/mFwmNfkTdrU

    Is this what you trying to achieve?
     
  46. bugrit

    bugrit

    Joined:
    Jul 20, 2013
    Posts:
    3
    Oh wow, totally missed the mesh colliders option, was looking too hard, heh. Sorry JonnyHilly, thought you were talking about the mesh of the object I wanted to explode, silly me. Thanks guys.
     
  47. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    hello, i just bought your asset, it s just one of the best asset i purchase in the store, really amazing, there one thing i quite don t understand is these 2 method
    public void Crack()
    public void ExplodeCracked()

    i try to use them but with no result, what it suppose to do exactly?
    some hint would be appreciated, also i was wondering how difficult would be to use reuse these broken piece and apply a force like gravity or wind with turbulence that would be awesome .
     
  48. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    528
    one thing that could improve greatly that asset would be a local destruction, right now it s uniform, that would be more realistic if only part can be destroy, doing a whole in a big wall by exemple like in ghost in the shell. :)
     
  49. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi,

    Crack() is only for calculating the explosion in advance and ExplodeCracked() activate the fragments (runs the explosion visuals). The purpose of those functions is only to get higher performance. For example you can call Crack() on you game object in background and when you are close enough you call ExplodeCracked() to run the explosion immediately.

    To add force like gravity or wind would be awesome, you can look to FragmentPool class that holds all fragment pieces, they are just rigid bodies so extension should be very straightforward.
     
  50. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    That sounds really interesting, good idea... :).