Search Unity

Detonator Explosion System

Discussion in 'Assets and Asset Store' started by benthroop, Jul 29, 2014.

  1. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    Back in 2009 I wrote the Detonator Explosion System and it's been used in a lot of Unity projects. In fact if you look at the URL it was apparently the very first asset that Unity submitted to the Asset Store.

    However that was a really long time ago, especially in Unity years! Well recently I have been able to dedicate some time to maintaining it and this thread will serve as my contact point with the community.

    Please post any bug reports and feature requests in this thread. Thanks!

    EDIT 9/25/2019 - Detonator 2.0 for is live for all current versions of Unity (4.x - 2019.x) in the Asset Store. TheRealGrendel has been working with me at Frame Interactive to get it updated.
    Asset Store Link: https://www.assetstore.unity3d.com/en/#!/content/1
    GitHub Project: https://github.com/benthroop/Detonator
     
    Last edited: Sep 25, 2019
  2. fjalla

    fjalla

    Joined:
    Nov 6, 2012
    Posts:
    73
    Downloaded this link, but the problem with normal maps continue.
     
  3. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    Dr Jellyface - try the version that was just posted to the Asset Store, or grab it via the Dropbox link in the first post.
     
  4. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Thanks very much for this awesome asset.

    The update I just grabbed from the asset store did not complain about normal maps not being flagged correctly.

    There is one issue I'm not sure how to address. When you click on the cube wall to trigger an explosion, there's a brief pink flash coming from the click point.

    This was happening in the previous version as well.

    I've attached a screenshot.

    I'm guessing there's a material not setup correctly or maybe a missing texture.

    How do I correct this?
     

    Attached Files:

  5. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    Schmosef, are you in Unity free by any chance? That might be the heatwave which requires render to texture. I didn't test on free... maybe I should. Anyway, try grabbing that Dropbox link at the top of the thread. I reassigned the materials in Unity 4.0 so it might work better now. Let me know.
     
  6. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Nope, I'm on Pro.

    I'll try the drop box link and let you know if it's any better.
     
  7. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Ok, I tried it. The pink is the same.

    I forgot to mention before that if you reduce the detail level slider by about 10% the pink flash goes away.
     
  8. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    I just did a build for Windows Store. It works!

    There's no pink flash either.

    It's kind of slow on my Tegra 3 based SurfaceRT, but it works.
     
  9. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    So it works in your build but you still get pink in the editor? You should be able to tell what object it is by pausing the game and selecting it. Let me know which object it is if you can. Thanks!
     
  10. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Sorry, I should have thought of that. It looks like the "Heatwave" object.
     

    Attached Files:

  11. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Just following up because it would be great to get this working.

    When I look at the HeatDistort shader in the inspector, the attached error is displayed.

    I'm guessing that this is what's causing the pink flash. My graphics card is an nVidia 660GTX. Maybe you have an AMD based card?

    Is there anything I can do to fix the shader or remove the pink flash?
     

    Attached Files:

  12. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    Schmosef, there's a new version up. Give that a shot? Sorry for the issues. I have an Nvidia based card as well (750m).
     
  13. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    I tried the new version yesterday. Same issue with the shader.

    Is there a way to disable it?
     
  14. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    844
    This means now Detonator works using the new particle system?
     
  15. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Good question.
     
  16. ThiefMaster

    ThiefMaster

    Joined:
    Sep 21, 2014
    Posts:
    1
    I tried adding some explosions to the 2D game created in this tutorial. However, the explosions always appear behind the decoration. I tried playing around with the Z value and also tried setting the sortingLayerName in code but neither worked. Any ideas what could be causing this?
     
  17. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    @Novack - Detonator still uses the legacy particle system.

    @ThiefMaster - Detonator creates a lot of child objects that don't inherit their layer from the parent Detonator object. This is lame and a good feature for next release. I've attached a patched Detonator.cs that will do this. Replace the current Detonator.cs and you should be able to set the layer of the parent object it will inherit. Let me know how it goes.
     

    Attached Files:

  18. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Am I the only one having trouble with the heatwave shader?
     
  19. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    @schmosef - are you on Unity free? What is your video card?
     
  20. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    I'm on a Unity Pro subscription. My card is an NVidia 660 GTX.
     
  21. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    Hmm... can you go make a new project, redownload the package through the asset store, import it, and tell me if you still get the pink. Specifically, you should NOT get the warnings about texture import when you import the package. If you do, then somehow you've still got an old version. Let me know how that goes.
     
  22. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Sure, I'll try it now.
     
  23. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    I tried a new project and I had the same problem.

    The issue is not with texture importing. It's with the HeatDistort shader.

    I found this thread with other people talking about the same problem. I made the shader code change suggested by @Chronixxas and it seems to work.
     
  24. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,519
    You simply need to remove the .xyw

    Old code:
    Code (csharp):
    1. half4 col = tex2Dproj( _GrabTexture, i.uvgrab.xyw );
    New code:
    Code (csharp):
    1. half4 col = tex2Dproj( _GrabTexture, i.uvgrab );
     
    bulathard likes this.
  25. JeevanjotSingh

    JeevanjotSingh

    Joined:
    Apr 30, 2014
    Posts:
    251
    can i use them commercially in my game for free?
     
  26. JeevanjotSingh

    JeevanjotSingh

    Joined:
    Apr 30, 2014
    Posts:
    251
    and will you share with us in which tool you created them and how?
     
  27. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    Yes, like all other Asset Store assets, you can use it for free and even without attribution.
     
    Jenifer_Jane likes this.
  28. JeevanjotSingh

    JeevanjotSingh

    Joined:
    Apr 30, 2014
    Posts:
    251
    I am very glad by listing this reply .
    Thanks for making such a great think like this .
    Keep up the good work!
     
  29. unwitty

    unwitty

    Joined:
    Jan 18, 2015
    Posts:
    31
    Thanks for making this! This has saved me several hours of work to get good looking explosions!

    Any ideas on rotating the Detonator-Upwards prefab so that the plume is in a direction other than world up?
     
  30. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    262
    On the main Detonator component there is a checkbox "Use World Space". I think that will work but I haven't tested it in a long time!
     
  31. unwitty

    unwitty

    Joined:
    Jan 18, 2015
    Posts:
    31
    Will play around with it some more. Thanks again!
     
  32. djoshi

    djoshi

    Joined:
    Mar 28, 2014
    Posts:
    182
    Is this compatible & smooth on mobile platforms?
     
    fschneider likes this.
  33. unwitty

    unwitty

    Joined:
    Jan 18, 2015
    Posts:
    31
    For the love of me, I can't remove the explosion force. I don't want the explosion to be affecting the rigidbodies at all, and I've even gone as far as removing all lines of code involving the keyword "force."

    I still can't get it to not push/blow away objects!

    Help.
     
  34. RREALITY

    RREALITY

    Joined:
    Jul 17, 2013
    Posts:
    6
    Hi all,

    I ran into the same pink plane problem, google took me here, I fixed issue by changing the line to
    1. half4 col = tex2Dproj( _GrabTexture, i.uvgrab );
    However, it seems it only render quarter (or half) of the heatwave!? I've tried this fix and the 2-line fix in another thread but still only show a portion of it. Please see the attached image. This is an awesome demo, thanks so much for putting this together!!! Please help me with the final step, how do I get it to show the whole heatwave like the one in the demo, many many thanks!

    best,
    quarterHeatwave.gif
     
    Last edited: Mar 6, 2015
  35. pwhiteside

    pwhiteside

    Joined:
    Mar 10, 2015
    Posts:
    1
    Noob question: how are the collisions done? I have poked around but can't seem to find the collider or whatever.
    Using Unity 5 Free version.
     
  36. Zmey

    Zmey

    Joined:
    Nov 28, 2013
    Posts:
    2
    small bug : Camera.main not always assigned, for example in multi camera setup
     
    Schoolie440 likes this.
  37. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    First of all, great work! I currently have two questions:

    1. How is the performance on mobile devices?
    2. The spray always seems to fly towards the main cam. This looked awkwards in situations where I scaled up the whole component and moved the cam far away from the explosion. Can I make it behave differently?
     
  38. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    Yes, that also happened to me. So I tagged multiple cams as the main cam. No problems till now. Just have to make sure that there is only one of these active at a time, I guess.
     
  39. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    I have another question: For a given detonator with detonator spray, I would like to set the max size for all its particle emitters at runtime. It seems when instantiating the prefab, the game objects with the particle emitters are not there yet. Any hint regarding that?
     
  40. mwfelker

    mwfelker

    Joined:
    Nov 2, 2011
    Posts:
    10
    Hey Everyone,

    FYI that this does work in Unity 5 - there are just a few scripts that don't work. Specifically, they are the heat wave and shock wave scripts. If those are disabled, there are no issues visually.

    Thought I'd mention it but would rather see a Unity 5 update for this package!
     
  41. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Thanks very much for the unity 5 compatibility tip, and I agree that a full unity 5 update would be great, but considering that this is a free asset I do not if it will happen, or at least soon, he offered kindly this great, amazing and powerful asset with beautiful explosions for frèe
     
  42. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    I'm updating one of my older games and the plan is to update/optimize Detonator to use the latests particle system as the current system appears to be quite a performance hit in the profiler. Although an official update would be great!
     
  43. DiebeImDunkeln

    DiebeImDunkeln

    Joined:
    Nov 17, 2014
    Posts:
    8
    I really like this detonator, but I have the problem that no particles appear if I build a Mac .app file.
    It works fine on a Mac in the Editor and also fine on a PC in the Editor and in the build .exe file, but not in a Mac .app file build. Any ideas?
     
  44. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    In case anyone has missed it, the "Particles" scene in the free Standard Assets Example project for Unity 5.x is very similar to this asset.
     

    Attached Files:

  45. DiebeImDunkeln

    DiebeImDunkeln

    Joined:
    Nov 17, 2014
    Posts:
    8
    I found a solution for my problem. I had to go to ProjectSettings -> Graphics and add 2 needed particle shaders. Otherwise they can't be found in the Mac .app build.

    Example picture:
     
  46. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Probably best to raise that as a bug as they should be automatically included.
     
  47. DiebeImDunkeln

    DiebeImDunkeln

    Joined:
    Nov 17, 2014
    Posts:
    8
    if I use the test scene in the same project, they will be added automatically. But if I use the test prefabs in my own project they are not added. But only in the Mac build. In the pc build all is running fine.
     
  48. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
  49. Peecha

    Peecha

    Joined:
    Dec 2, 2013
    Posts:
    23
    Hey @benthroop
    i like your detonator system. But sometimes i encounter crash on ios:

    Code (CSharp):
    1. Can't add component because class 'EllipsoidParticleEmitter' doesn't exist!
    2. UnityEngine.GameObject:AddComponent(String)
    3. DetonatorBurstEmitter:Awake()
    4. UnityEngine.GameObject:AddComponent(String)
    5. DetonatorFireball:BuildFireballA()
    6. DetonatorFireball:Init()
    7. Detonator:UpdateComponents()
    8. Detonator:Start()
    9.  
    10. [ line 38]
    11. (Filename:  Line: 38)
    12.  
    13. NullReferenceException: A null value was found where an object instance was required.
    14.   at DetonatorBurstEmitter.Awake () [0x00000] in <filename unknown>:0
    15.   at UnityEngine.GameObject.AddComponent (System.String className) [0x00000] in <filename unknown>:0
    16.   at DetonatorFireball.BuildFireballA () [0x00000] in <filename unknown>:0
    17.   at DetonatorFireball.Init () [0x00000] in <filename unknown>:0
    18.   at Detonator.UpdateComponents () [0x00000] in <filename unknown>:0
    19.   at Detonator.Start () [0x00000] in <filename unknown>:0
    20. UnityEngine.GameObject:AddComponent(String)
    21. DetonatorFireball:BuildFireballA()
    22. DetonatorFireball:Init()
    23. Detonator:UpdateComponents()
    24. Detonator:Start()
    Using unity3d 4.6.7p2, iOS 8.4
     
    Last edited: Jul 29, 2015
  50. ChrisAntaki

    ChrisAntaki

    Joined:
    Aug 21, 2013
    Posts:
    1
    I'm really impressed with Detonator! At first I thought it was broken in Unity 5. Placing all of its assets into the "Resources" folder fixed everything though.
     
    Last edited: Nov 3, 2015
    Lee7 likes this.