Search Unity

Exploder [RELEASED]

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

  1. Dolzen

    Dolzen

    Joined:
    Mar 26, 2014
    Posts:
    90
    Hello! I think I need some help here...
    I have uploaded a mesh that I'm trying to explode using Exploder, it is a planet, but no matter the settings I chose in the exploder prefab it is always exploding in a single fragment even if my target fragments are 20 or more. I think it is something wrong with my mesh because other meshes like the unity default sphere is exploding fine, but I need to know what is wrong with my mesh since it is generated procedurally and I need to know what to fix or what settings to use to make it work.

    Any help would be appreciated.

    Edit: I forgot to mention that if I disable triangulation it works but the fragments are missing the inside.
     

    Attached Files:

  2. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    151
    How does the performance of this compare to the other explosion assets?
     
  3. jimslade

    jimslade

    Joined:
    Apr 22, 2016
    Posts:
    2
    Hey, great asset. One question though: I've found a method to partially explode a mesh on the exploder singleton instance. But when I call it, nothing happens (even if I crack my mesh before calling it as an error message suggested). Is this already implemented or am I doing something wrong?

    Also, can it be that the explosion callback is called twice, one time for cracking and one time for exploding the cracked mesh?

    Keep up the great work! Thx in advance!
     
  4. mikecaputo

    mikecaputo

    Joined:
    Jul 9, 2017
    Posts:
    18
    @reindeer-games Great product, is there a way to have the mesh cutting start from a specific position? Ie in the demo scene if I click the top-left corner of the wooden board then the cracking/exploding starts from the upper-left (currently it uses the center). Thanks.
     
  5. dlstilts

    dlstilts

    Joined:
    Sep 29, 2017
    Posts:
    40
    @reindeer-games Hi I am trying to use your exploder with ufps 1.73. I added the two lines of code to DoHit() and it does not work? I also checked the bullet script was assigned to the bullets and the gun and I added a exploder prefab to the scene? I don't know what else to do? I also added a ufps controller to your first person game with the bullet script and still nothing?

    Please help. Thanks!
     
  6. reindeer-games

    reindeer-games

    Joined:
    Mar 5, 2013
    Posts:
    547
    Hi, 1.73 should work, can you Debug.Log the object name you are trying to explode on the line where you call exploder.ExplodeObject(...), to double check that's the object you are trying to explode. Also make sure that the objects you want to explode are not marked as static. For example the crates from UFPS demo works fine.
     
  7. dlstilts

    dlstilts

    Joined:
    Sep 29, 2017
    Posts:
    40
    Hi I am trying with non static objects, just plain cubes and even tried it with your first person example objects? Nothing works...
    Hope can figure this out soon on a deadline. Thanks!

    this is what I get in the console:
    NullReferenceException: Object reference not set to an instance of an object
    vp_Bullet.DoHit () (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_Bullet.cs:173)
    vp_Bullet.TryHit () (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_Bullet.cs:157)
    vp_Bullet+<TryHitOnEndOfFrame>c__Iterator0.MoveNext () (at Assets/UFPS/Base/Scripts/Gameplay/Combat/vp_Bullet.cs:342)
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

    And in the debug log:
    Exploder: using 3 threads.
    UnityEngine.Debug:LogFormat(String, Object[])
    Exploder.CutterMT:.ctor(Core) (at Assets/Exploder/Exploder/Core/Tasks/CutterMT.cs:26)
    Exploder.Core:Initialize(ExploderObject) (at Assets/Exploder/Exploder/Core/Core.cs:62)
    Exploder.ExploderObject:Awake() (at Assets/Exploder/Exploder/ExploderObject.cs:527)
     
  8. dlstilts

    dlstilts

    Joined:
    Sep 29, 2017
    Posts:
    40
    Hi Actually figured it out. Cheers
     
    reindeer-games likes this.
  9. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Hi, does anyone know or can point me to the script where I can increase the maximum fragment pool size, I want to have it go over 1000. Also, is there a way I can have the fragments stay in scene forever? Thanks for any help.
     
  10. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Update, found the answer to my first question, would still appreciate any guidance on my 2nd question if possible. Thanks
     
  11. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Another question, would this asset benefit from conversion to the 2018 burst compiler/Job System?
     
  12. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    Multithreaded crash "Ensure running on main thread"
    80% repro
    Happens when I destroy many objects in rapid succession from a chain reaction explosion.
    Still happens after setting "Multi-threading" to "Disabled"

    upload_2019-1-6_13-42-0.png
     
    Last edited: Jan 6, 2019
  13. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    Another crash, when many objects are destroyed at once

    Using multithreaded

    upload_2019-1-8_14-30-44.png
     
  14. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    After some investigation this seems to be a design flaw with the system. It processes a game object over several frames depending on the frame budget, but does not check if that object remains valid.

    public GameObject original;
    public GameObject skinnedOriginal;
    public GameObject bakeObject;


    To fix it, I've added code to Core.RunTask to remove entries from meshSet where MeshObject.original is null

    Code (CSharp):
    1. // KevinJ: Remove dead entries
    2.             deadEntries.Clear();
    3.             foreach (MeshObject mo in meshSet)
    4.             {
    5.                 if (mo.original == null)
    6.                     deadEntries.Add(mo);
    7.             }
    8.             foreach (MeshObject mo in deadEntries)
    9.             {
    10.                 meshSet.Remove(mo);
    11.             }
     
    Last edited: Jan 8, 2019
    atomicjoe likes this.
  15. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    Next issue:

    ExploderQueue.Enqueue does not check for duplicates. An object destroyed by multiple sources in the same frame would be fragmented multiple times.

    Fix:
    Code (CSharp):
    1. List<int> nonDuplicatedIndices = new List<int>();
    2.         public void Enqueue(ExploderObject exploderObject, ExploderObject.OnExplosion callback, bool crack, params GameObject[] target)
    3.         {
    4.             // nonTargetDuplicatedIndices holds indices of target that are not duplicated by already being in "queue"
    5.             nonDuplicatedIndices.Clear();
    6.  
    7.             for (int i = 0; i < target.Length; i++)
    8.             {
    9.                 bool duplicated = false;
    10.                 foreach (var q in queue)
    11.                 {
    12.                     for (int j = 0; j < q.Targets.Length; j++)
    13.                     {
    14.                         if (q.Targets[j] == target[i] && q.Crack == crack)
    15.                         {
    16.                             duplicated = true;
    17.                         }
    18.                     }
    19.                 }
    20.                 if (duplicated == false)
    21.                 {
    22.                     nonDuplicatedIndices.Add(i);
    23.                 }
    24.             }
    25.  
    26.             if (nonDuplicatedIndices.Count == target.Length)
    27.             {
    28.                 // Nothing was duplicated so run the original code
    29.                 var settings = new ExploderParams(exploderObject)
    30.                 {
    31.                     Callback = callback,
    32.                     Targets = target,
    33.                     Crack = crack,
    34.                     processing = false
    35.                 };
    36.  
    37.                 queue.Enqueue(settings);
    38.                 ProcessQueue();
    39.             }
    40.             else if (nonDuplicatedIndices.Count > 0)
    41.             {
    42.                 // Make a new array to hold non-duplicated GameObjects
    43.                 GameObject[] nonDuplicatedTargets = new GameObject[nonDuplicatedIndices.Count];
    44.                 for (int i = 0; i < nonDuplicatedIndices.Count; i++)
    45.                 {
    46.                     nonDuplicatedTargets[i] = target[nonDuplicatedIndices[i]];
    47.                 }
    48.                 var settings = new ExploderParams(exploderObject)
    49.                 {
    50.                     Callback = callback,
    51.                     Targets = nonDuplicatedTargets,
    52.                     Crack = crack,
    53.                     processing = false
    54.                 };
    55.  
    56.                 queue.Enqueue(settings);
    57.                 ProcessQueue();
    58.             }
    59.         }
    60.  
     
    Last edited: Jan 20, 2019
    atomicjoe likes this.
  16. trojanfoe_

    trojanfoe_

    Joined:
    May 20, 2014
    Posts:
    53
    That looks like terrible code. Why not copy the array to a Set of some kind?
     
  17. KisiMobar

    KisiMobar

    Joined:
    Feb 23, 2018
    Posts:
    1
  18. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Emie_PB and KisiMobar like this.
  19. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    Another bugfix: Preprocess.GetMeshData assumes a 1:1 correspondence between MeshRenderer and MeshFilter. This is unnecessary and doesn't handle assets that have an extra MeshFilter.

    Old code:
    Code (CSharp):
    1. var renderers = obj.GetComponentsInChildren<MeshRenderer>();
    2.             var meshFilters = obj.GetComponentsInChildren<MeshFilter>();
    3.  
    4.             ExploderUtils.Warning(renderers.Length == meshFilters.Length, "Renderers and meshes don't match!");
    5.  
    6.             if (renderers.Length != meshFilters.Length)
    7.             {
    8.                 return new List<MeshData>();
    9.             }
    Fix:
    Code (CSharp):
    1. var renderers = obj.GetComponentsInChildren<MeshRenderer>();
    2.             // KevinJ: Don't assume the artist had no leftover MeshFilters, read them as necessary
    3.             /*
    4.             var meshFilters = obj.GetComponentsInChildren<MeshFilter>();
    5.  
    6.             ExploderUtils.Warning(renderers.Length == meshFilters.Length, "Renderers and meshes don't match!");
    7.  
    8.             if (renderers.Length != meshFilters.Length)
    9.             {
    10.                 return new List<MeshData>();
    11.             }
    12.             */
    13.  
    14.             var outList = new List<MeshData>(renderers.Length);
    15.  
    16.             for (int i = 0; i < renderers.Length; i++)
    17.             {
    18.                 MeshFilter meshFilter = renderers[i].GetComponent<MeshFilter>();
    19.                 if (meshFilter == null)
    20.                 {
    21.                     ExploderUtils.Log("Missing MeshFilter in " + renderers[i].name);
    22.                     continue;
    23.                 }
    24.  
    25.                 if (meshFilter.sharedMesh == null)
    26.                 {
    27.                     ExploderUtils.Log("Missing shared mesh in " + renderers[i].name);
    28.                     continue;
    29.                 }
    30.  
    31.                 if (!meshFilter.sharedMesh || !meshFilter.sharedMesh.isReadable)
    32.                 {
    33.                     UnityEngine.Debug.LogWarning("Mesh is not readable: " + renderers[i].name);
    34.                     continue;
    35.                 }
     
    atomicjoe and hopeful like this.
  20. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    Here is another bugfix.
    I had reported this by email but never got a response and the fix was never put in.

    Context:
    Code (CSharp):
    1.  
    2.  diffPos = originalObject.transform.position - initPos;
    3. // KevinJ: Bugfix from diffRot = originalObject.transform.rotation * Quaternion.Inverse(initRot);
    4. // This shows up if a mesh is not centered around the origin and rotates from its initial starting position. You are applying the local space rotation to world space rotation in your version. A non-centered object changes position in this case.
    5. // Sent an email to the author on 9/5/17
    6. diffRot = Quaternion.Inverse(initRot) * originalObject.transform.rotation;
    7.  
     
    montyfi and hopeful like this.
  21. Daniiii

    Daniiii

    Joined:
    Nov 13, 2013
    Posts:
    24
    I get some pretty huge (100ms huge) memory allocation spikes when first colliding/exploding a bunch of objects. Then some smaller alloc and collection spikes throughout.

    Any tips on how to reduce memory allocations with Exploder?
     
  22. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    What kind of object(s) is it, does it have many vertices/faces? Do you see the same if eg doing the same with primitive cubes? Have you tried turning off some options like add mesh colliders?
     
  23. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Hope it is ok, would like to share an alpha version "trailer" for a game I'm making that uses exploder (with some of my own addons)...
     
    Last edited: May 13, 2019
    tosvus likes this.
  24. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    How does the system work with LOD? Does it explode each of the LOD meshes (child renderers) or only the current LOD?
     
  25. emptybraces

    emptybraces

    Joined:
    Mar 30, 2015
    Posts:
    22
    Hi,
    The following error has occurred in the released game.
    I think latest version used.
    I am in trouble because I can not reproduce it.
    Code (CSharp):
    1. ArgumentException: An element with the same key already exists in the dictionary.
    2.   at System.Collections.Generic.Dictionary`2[System.Int32,System.Int32].Add (Int32 key, Int32 value) [0x00171] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:432
    3.   at Exploder.CutterMT.SplitMeshTargetFragments (Int32 id) [0x00069] in C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\Tasks\CutterMT.cs:239
    4.   at Exploder.CutterMT.Cut (Single frameBudget) [0x00136] in C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\Tasks\CutterMT.cs:149
    5.   at Exploder.CutterMT.Run (Single frameBudget) [0x00003] in C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\Tasks\CutterMT.cs:68
    6.   at Exploder.Core.RunTask (TaskType taskType, Single budget) [0x0000a] in C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\Core.cs:263
    7.   at Exploder.Core.StartExplosionFromQueue (Exploder.ExploderParams p) [0x000bd] in C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\Core.cs:156
    8.   at Exploder.ExploderQueue.ProcessQueue () [0x0004e] in C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\ExploderQueue.cs:118
    9.   at Exploder.ExploderQueue.Enqueue (Exploder.ExploderObject exploderObject, Exploder.OnExplosion callback, Boolean crack, UnityEngine.GameObject[] target) [0x00034] in C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\ExploderQueue.cs:105
    10.   at Exploder.Core.Enqueue (Exploder.ExploderObject exploderObject, Exploder.OnExplosion callback, Boolean crack, UnityEngine.GameObject[] obj) [0x0000c] in C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\Core.cs:75
    11.   at Exploder.ExploderObject.ExplodeObject (UnityEngine.GameObject obj, Exploder.OnExplosion callback) [0x00001] in C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\ExploderObject.cs:315
    12.   at Exploder.ExploderObject.ExplodeObject (UnityEngine.GameObject obj) [0x00004] in C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\ExploderObject.cs:304
    13.   at TOD.EffectManager.ExplodeObject (UnityEngine.GameObject target, Int32 fragmentNum, Single force, System.String fragmentLayer, Boolean disableTriangulation) [0x0006c] in C:\projects\MYGAMENAMES\Assets\Scripts\Scene\20_Stage\EffectManager.cs:171
    14.   at TOD.BulletBase.InactiveBullet (Boolean cameraOut) [0x000bb] in C:\projects\\Assets\Scripts\Character\Bullet\BulletBase.cs:517
    15.   at TOD.BulletPhysics+<TimeBomb>c__Iterator0.MoveNext () [0x001e5] in C:\projects\MYGAMENAMES\Assets\Scripts\Character\Bullet\BulletPhysics.cs:138
    16.   at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0
    17. (Filename: /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs Line: 432)
    18.  
    19. Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "FragmentRoot/fragment_57"
    20. UnityEngine.GameObject:SetActive(Boolean)
    21. Exploder.ExploderUtils:SetActiveRecursively(GameObject, Boolean) (at C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Utils\ExploderUtils.cs:140)
    22. Exploder.Fragment:Explode(ExploderParams) (at C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Fragments\Fragment.cs:352)
    23. Exploder.PostprocessExplode:Run(Single) (at C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\Tasks\PostprocessExplode.cs:147)
    24. Exploder.Core:RunTask(TaskType, Single) (at C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\Core.cs:263)
    25. Exploder.Core:Update() (at C:\projects\MYGAMENAMES\Assets\Plugins\Scripts\Exploder\Exploder\Core\Core.cs:175)
    26. ...
    27. Similar "Infinity or ..." errors repeat.
     
  26. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    Is this plugin dead or still being supported? Would just love to know either way whether to expect updates or whether to modify it ourselves?
     
  27. tosvus

    tosvus

    Joined:
    Dec 27, 2016
    Posts:
    44
    Can this be used for instance with a sword? slicing/chipping?
     
  28. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Could do, but if you want a precise cut I don't think you'll get that done accurately, maybe you need a mesh cutter type script, there are some available, e.g. on asset store I think. Hope that helps.
     
  29. tosvus

    tosvus

    Joined:
    Dec 27, 2016
    Posts:
    44
    Thanks Khos, your trailer looks really good by the way! :)
     
    khos likes this.
  30. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Cool, thanks, there you can see a little bit what exploder can do :) (I updated the video link to a new updated trailer)
    PS I also use mesh cutting (for lasers), for that I use a different script/method.
     
  31. Volkerku

    Volkerku

    Joined:
    Nov 23, 2016
    Posts:
    114
    Pre-crack in a build.
    Greta asset in general. For me "pre-cracking" the meshes is important due to Android platform limitations. However, if I pre-crack my meshes it works fine in editor, but if I build the application (still under Windows) nothing happens.
    Turning off pre-crack and build again, it does work.
    Any ideas?
     
  32. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Hi there.
    First: how do you pre-crack them? Which option is it, or how do you do this, I'd like to understand more.
    Second: When you say nothing happens can you provide details, eg you add a rigidbody but it does not fall down? Have you changed the editor to Android build type and graphics emulation?
    Third: I did not realise this asset can pre-crack... I don't think so, but know of other more expensive assets out there that can do this.
    Four:Why is it so important to have this, due to performance?
     
  33. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    How does the system work with LOD? Does it explode each of the LOD meshes (child renderers) or only the current LOD?
     
  34. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    I think you can add your own mesh/objects/LOD, control it that way.
     
    Last edited: Aug 28, 2019
  35. AMAT_Sooraj

    AMAT_Sooraj

    Joined:
    Sep 20, 2018
    Posts:
    6
    @reindeer-games
    Hello,

    I have a requirement where I need to implement something like a CAD tool exploded view on a complex group of meshes. I don't want to fragment/split/destroy single meshes, but rather move them away from each other. For eg. Exploded view of a car engine to see whats on the inside.
    Is this possible with this Exploder asset?
     
  36. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    No this asset is just for fragmenting single meshes into multiple meshes (although it does blow them apart using physics). You will want to find the centroid of all the mesh transforms you want to blow apart, then lerp their translations outward relative to that point. Here is an implementation of finding the centroid from an array of positions:

    Code (CSharp):
    1.         /// <summary>
    2.         /// Find the centroid of the points.
    3.         /// </summary>
    4.         /// <param name="points">The points.</param>
    5.         /// <returns>The position of the centroid.</returns>
    6.         public static Vector3 CalculateCentroid(Vector3[] points)
    7.         {
    8.             float area = 0.0f;
    9.             float Cx = 0.0f;
    10.             float Cz = 0.0f;
    11.             float tmp = 0.0f;
    12.             int k;
    13.  
    14.             for (int i = 0; i <= points.Length; i++)
    15.             {
    16.                 k = (i + 1) % (points.Length + 1);
    17.                 tmp = points[i].x * points[k].z -
    18.                       points[k].x * points[i].z;
    19.                 area += tmp;
    20.                 Cx += (points[i].x + points[k].x) * tmp;
    21.                 Cz += (points[i].z + points[k].z) * tmp;
    22.             }
    23.             area *= 0.5f;
    24.             Cx *= 1.0f / (6.0f * area);
    25.             Cz *= 1.0f / (6.0f * area);
    26.  
    27.             return new Vector3(Cx, 0, Cz);
    28.         }
    Depending on how you want to blow apart your object you will have to write your own code to move the objects from the centroid since there are many considerations, i.e. will parts be moved in an order, will they move multiple at a time if so will they collide/clip etc. depends on your projects needs, I'll leave that to you.
     
  37. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    I am quite sure this asset can handle multiple meshes at once. It depends on which meshes are within the exploder radius ( diameter can be adjusted), any objects within that will be exploded in the same explode call.

    Sample screenshot, this explode affected at least 4 objects
    upload_2019-8-30_23-47-38.png

    Also in my game (shown above) I can rewind the explosions, where fragments are tracked and can rewind to original positions, that might be useful to implement for a CAD explosion type scenario.
     
  38. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    Hm, I'm not sure what you mean by "add your own mesh.."?
     
  39. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Did you have a good look at the asset and all it's features yet to see what is possible, read the docs? On the exploder component, the bottom has options to add your own fragment prefabs:
    upload_2019-8-31_0-8-10.png
    I might be misunderstanding you, but with some testing/setup I believe these highlighted areas will allow you to do what you ask.
     

    Attached Files:

  40. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    325
    @khos
    From my understanding of the question from @AMAT_Sooraj they do not want the models to fracture.

    Exploder definatly can fracture multiple at once (individually through one synchronous trigger) but I think he wants is a blown apart view of multiple separate meshes (Like taking something apart as you would see in a 3D engineering video). Exploder can not do this without fracturing each of those meshes.

    You could record the physics and lerp it back/fourth but the parts will still have to be fractured to be blown apart.

    I think he want something like World of Guns: Gun Disassembly
    https://store.steampowered.com/app/262410/World_of_Guns_Gun_Disassembly/

    He would have to implement the physics operation that exploder does to the exploded mesh. (Which I'm pretty sure just finds the centroid and applies force to the rigidbodies). Which is probably not ideal unless they want their break apart to fall to the ground.

    In other words no, exploder can't just blow things apart without fracturing the mesh.
     
  41. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    Hm, what I'm referring to is when you have an LOD group it seems the exploder explodes each of the lod objects instead of only the currently visible LOD. So lets say you have a wall and it has 3 lods underneath it, when the wall is destroyed, all 3 lod children objects explode as well creating a lot more pieces and wasted processing, rather than only exploding the lod child object that is active.
     
  42. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Think about it some more, the way I see it: It's a fragment prefab, that is the part is shown after the explosion has happened not before..I think LODs will work normal on that.
     
  43. cj31387

    cj31387

    Joined:
    May 23, 2012
    Posts:
    143
    Is this possible yet, I notice when i explode a object it makes a new gameobject named FragmentRoot. Any way to reference this gameobject on explode, ExploderSingleton.Instance.ExplodeObject() is void.
     
  44. Emie_PB

    Emie_PB

    Joined:
    Mar 9, 2019
    Posts:
    1
    thank you so so so much, I've been digging in this forum and the codes and looking for a solution for 2 days now and I couldn't figure out why it doesn't explode my imported meshes but only the Unity basic geometry ones. This did the trick :)
     
  45. Bradamante

    Bradamante

    Joined:
    Sep 27, 2012
    Posts:
    300
    When I try to explode a GameObject with Exploder I only get mesh errors:

    Code (CSharp):
    1. IndexOutOfRangeException: Index was outside the bounds of the array.
    2. Exploder.MeshCutter.Cut (Exploder.ExploderMesh mesh, Exploder.ExploderTransform meshTransform, Exploder.Plane plane, System.Boolean triangulateHoles, System.Boolean allowOpenMesh, System.Collections.Generic.List`1[Exploder.ExploderMesh]& meshes) (at Assets/Plugins/Exploder/Scripts/Core/MeshCutter.cs:238)
    The documentation mentions no such error.
    Full trace:

    Code (csharp):
    1.  
    2. IndexOutOfRangeException: Index was outside the bounds of the array.
    3. Exploder.MeshCutter.Cut (Exploder.ExploderMesh mesh, Exploder.ExploderTransform meshTransform, Exploder.Plane plane, System.Boolean triangulateHoles, System.Boolean allowOpenMesh, System.Collections.Generic.List`1[Exploder.ExploderMesh]& meshes) (at Assets/Plugins/Exploder/Scripts/Core/MeshCutter.cs:238)
    4. Exploder.MeshCutter.Cut (Exploder.ExploderMesh mesh, Exploder.ExploderTransform meshTransform, Exploder.Plane plane, System.Boolean triangulateHoles, System.Boolean allowOpenMesh, System.Collections.Generic.List`1[Exploder.ExploderMesh]& meshes, UnityEngine.Color crossSectionVertexColor, UnityEngine.Vector4 crossUV) (at Assets/Plugins/Exploder/Scripts/Core/MeshCutter.cs:171)
    5. Exploder.CutterST.CutSingleMesh (Exploder.MeshObject mesh) (at Assets/Plugins/Exploder/Scripts/Core/Tasks/CutterST.cs:160)
    6. Exploder.CutterMT.Cut (System.Single frameBudget) (at Assets/Plugins/Exploder/Scripts/Core/Tasks/CutterMT.cs:138)
    7. Exploder.CutterMT.Run (System.Single frameBudget) (at Assets/Plugins/Exploder/Scripts/Core/Tasks/CutterMT.cs:70)
    8. Exploder.Core.RunTask (Exploder.TaskType taskType, System.Single budget) (at Assets/Plugins/Exploder/Scripts/Core/Core.cs:263)
    9. Exploder.Core.StartExplosionFromQueue (Exploder.ExploderParams p) (at Assets/Plugins/Exploder/Scripts/Core/Core.cs:156)
    10. Exploder.ExploderQueue.ProcessQueue () (at Assets/Plugins/Exploder/Scripts/Core/ExploderQueue.cs:118)
    11. Exploder.ExploderQueue.Enqueue (Exploder.ExploderObject exploderObject, Exploder.ExploderObject+OnExplosion callback, System.Boolean crack, UnityEngine.GameObject[] target) (at Assets/Plugins/Exploder/Scripts/Core/ExploderQueue.cs:105)
    12. Exploder.Core.Enqueue (Exploder.ExploderObject exploderObject, Exploder.ExploderObject+OnExplosion callback, System.Boolean crack, UnityEngine.GameObject[] obj) (at Assets/Plugins/Exploder/Scripts/Core/Core.cs:75)
    13. Exploder.ExploderObject.ExplodeObject (UnityEngine.GameObject obj, Exploder.ExploderObject+OnExplosion callback) (at Assets/Plugins/Exploder/Scripts/ExploderObject.cs:315)
    14. Exploder.ExploderObject.ExplodeObject (UnityEngine.GameObject obj) (at Assets/Plugins/Exploder/Scripts/ExploderObject.cs:304)
    15. ControllerExploder.HandleMazeFighterDestroyed (UnityEngine.GameObject go, System.Int32 idx) (at Assets/Scripts/ControllerExploder.cs:31)
    16. EventForwarder.msgMazeFighterDestroyed (UnityEngine.GameObject go, System.Int32 idx) (at Assets/Scripts/EventForwarder.cs:42)
    17. HealthBehavior.OnProjectileHit (UnityEngine.GameObject projectile) (at Assets/Scripts/HealthBehavior.cs:26)
    18. CollisionBehavior.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/CollisionBehavior.cs:33)
    19.  
    Looks like it can't find my mesh?
     
    Last edited: Dec 1, 2019
  46. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    What kind of mesh is it, vertex number etc? unity ver?
     
  47. Bradamante

    Bradamante

    Joined:
    Sep 27, 2012
    Posts:
    300
    That would be Unity 2019.2.12. Not sure "what kind of mesh", but something super simple I created myself until the real artwork comes. Probably not enough vertices for Exploder, if that makes sense.
     
  48. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    Is it a Unity primitive object/mesh? Does it happen to other meshes, or just one, just trying to understand a bit more :)
     
  49. vice39

    vice39

    Joined:
    Nov 11, 2016
    Posts:
    108
    I have an OBJ that I made in Rhino3D and exported, for some reason it wont explode. I can explode anything else in the scene, but when I try to explode this OBJ nothing happens.

    Any ideas?
     
  50. wesley-lafer

    wesley-lafer

    Joined:
    Aug 20, 2012
    Posts:
    2
    Hello.

    I love this asset, I find it very easy to use with great results. However, as I've scaled up to a scene with ~20 identical explodable bottles, I've run into issues. The problem is that in real time, breaking them takes a few milliseconds, causing unacceptable lag. I tried using the Cracking feature to offload processing to the beginning, but this causes all the lag to occur at once at the beginning of the scene. I was wondering if there is a way to reduce this lag by either reusing the crack processing for all bottles, or by somehow baking the crack information into the object before the game is even built.

    Thanks.