Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[RELEASED] RayFire for Unity. Runtime demolition and fragmentation plugin.

Discussion in 'Assets and Asset Store' started by Mir-vadim, May 8, 2019.

  1. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    Of course you can, but there is one important step you should do before creating prefab.
    After you fragment your object using Shatter you should Export fragments meshes into asset file using button at the bottom of Shatter. After this all fragments meshes will reference to this asset meshes, then you can crate prefab.
    Without this step you will loose meshes in prefab because after fragmentation all meshes stored in scene and prefab won't be able to reference to them.
     
  2. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    Sorry, there is no built-in functionality for such effects. But I will think about this.
     
  3. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    Yes, I already made some tests and they were not as good as I expected. Mostly because I do not have a lot of heavy math methods, most of the code is component management which can not be moved in Job System and those math functions I have is not big enough to compensate time and memory I spend to pack everything in NativeArray and unpack data back to usable format after calculations.
    I need to rewrite them completely from scratch to avoid this step so they will be ready to be used with Job without all these extra steps.
    I will consider this for all new features I am going to add later and I guess at some point later I will rewrite existing code to make it more friendly for Job System.
     
  4. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    1. I will add some DemolishAll () method which will check if there are other Rigid components in Nested Cluster and demolish them as well. But you can do this for now by getting all fragments in demolished Rigid .framgents list and init demolition in your code for now.
    2. It is supported, only runtime mesh slicing/fragmentation not supported because it needs dlls which we need to compile for consoles.
    3. Of course you can post your code if you want.
     
  5. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    706
    I saw that this asset is on sale in the Asset Store.... It's such a cool asset! I'm developing with DOTS so I can't buy it right now -- Any developments in the DOTS/ECS/Jobs side of things?
     
  6. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    Sorry, there is no special support for DOTS for now. I tried recently to rewrite some parts of code with Job support, but since most of the plugin work is management of components (not heavy math) there was not any noticeable difference in performance.
     
    atomicjoe likes this.
  7. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    706
    Thanks for the reply. Is there any chance that it could at least be tweaked so that it could work without game-objects and monobehaviours even if it's not more performant? In a DOTS game where everything exists as entities, it is difficult and hacky to have to create, synchronize, and manage the lifetimes of temporary and/or unnecessary game objects that don't really do anything other than function as hacks to implement something that hasn't been implemented in ECS yet.
     
    Last edited: May 14, 2023
  8. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    Yeah, this is why there was not more performant with Jobs support, I had to convert all necessary data to NativeArrays and back to usable data. But you can of course try to edit code to use Jobs where you think it will work better. If you want I can send you full package to try it and check code, Sale just started, so you will have some time to decided if it is worth to buy.
     
  9. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    706
    I'm probably not doing a good job of explaining what I'm getting at. Looking at the demo video, I can see that a Monobehaviour component is added to a game-object called "RayfireRigid" and it has functions for RaycastRigid, Demolish, Activate, Fade, etc. In ECS if that gameobject was placed in a subscene, the entire RayFireRigid component and associated game-object would just disappear after pressing play and a useless empty entity would take its place. To be useful, I would need a Baker to convert that monobehaviour into an ECS component, but I have no idea how to do that or if it's even possible.

    The only alternative I can think of would be to keep all the destructible items as game-objects, however, they would be incompatible with everything else in the scene it's all represented as Entities instead of GameObjects.
     
  10. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    Well, then I guess you can't use it for now, I basically need to completely rewrite whole Rigid component (and other components) logic, having only Bakers will not be enough.
     
    lclemens likes this.
  11. unity_D823CE9B3E96D6748393

    unity_D823CE9B3E96D6748393

    Joined:
    Nov 16, 2022
    Posts:
    6
    Hi @Mir-vadim! Can this asset be used for a case.. where the part of a terrain is removed when a sphere collides with it? Kind of worms like destructible terrain but in 3d? The terrain is one mesh piece
     
  12. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    Hi, sorry, but no, there is no such support for now.
     
  13. unity_D823CE9B3E96D6748393

    unity_D823CE9B3E96D6748393

    Joined:
    Nov 16, 2022
    Posts:
    6
    Thanks! Is it possible that one part of mesh remains static and other dynamic when a collision occurs so it gives the effect of falling down? And all this needs to be dynamically at runtime

    Basically my use case is, There is a single mesh(dynamically generated) on which the player stands and shoots, the mesh should be destructible

    And lastly, does the plugin support shapes which have mesh collider with Convex unchecked? Basically non-convex shapes?
     
    Last edited: May 30, 2023
  14. AbelSierra

    AbelSierra

    Joined:
    Jul 19, 2018
    Posts:
    19
    Hello! I am having problems trying to make work dynamic batching with the shattered pieces, it just does not batch a single thing... Is it something supported?
     
  15. unity_D823CE9B3E96D6748393

    unity_D823CE9B3E96D6748393

    Joined:
    Nov 16, 2022
    Posts:
    6
    Another question, is it possible to pre-process a concave mesh and break it into pieces using your asset and then use nested clusters on it? Like in the video below, the ring already has pieces in the FBX model

     
  16. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    Hi, dynamic batching should work, can you contact with me in discord about this issue, so we will figure out why it doesn't work for you.
     
  17. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    it should use already applied colliders, doesn't it work in this way for you? and again, please, contact with me in discord to get support, sometimes I do not get notifications when someone post here new message.
     
  18. DrSeltsam

    DrSeltsam

    Joined:
    Jul 24, 2019
    Posts:
    100
    I would like to know if this tool is capable of fragmenting non-readable meshes (which don't have the Read/Write setting)? Not at runtime, but at least in the editor?
     
  19. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    No, this is one of the most frequent issue for a lot of users, they forget to make mesh readable.
    But I never tried to make it possible to fragment not readable meshes, I will make some research about this later.
     
    DrSeltsam likes this.
  20. DrSeltsam

    DrSeltsam

    Joined:
    Jul 24, 2019
    Posts:
    100
    Thanks @Mir-vadim , sounds good! :) It's understandable to require readable meshes at runtime, but in editor, the workflow would be a lot smoother if there was no need for readable meshes (I have lots of meshes and would like to create fragmented versions of them, not at runtime, only in the editor).
     
    floky likes this.
  21. floky

    floky

    Joined:
    Oct 6, 2010
    Posts:
    273
    I also agree with @DrSeltsam.
    Editor only workflow should not affect runtime optimizations decisions and runtime usage restrictions should only apply to runtime API usage only. ✌
     
  22. floky

    floky

    Joined:
    Oct 6, 2010
    Posts:
    273
    This should be doable by "wrapping" the API runtime methods used into a separate editor-only workflow tool / API that could automatically apply the required readable meshes flag (and cache the previous state of course) until the edit happens and then re-apply the previous state if necessary.
    Does this help?
     
  23. animal531

    animal531

    Joined:
    Aug 26, 2014
    Posts:
    25
    Does Rayfire use the new advanced mesh API to construct meshes, or still the old way?
     
  24. zenbin3d

    zenbin3d

    Joined:
    Jul 7, 2023
    Posts:
    11
    Good question!
     
  25. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    254
    Hi, for now we do not use it since we started develop it for Unity 2017 and Advanced Mesh API was added in 2021 if I am not wrong. But at this moment we are rewriting from scratch whole fragmentation engine for maximum efficiency in Unity so we will take Advanced Mesh API into account.
     
    Last edited: Sep 14, 2023
    AthrunVLokiz likes this.
  26. zenbin3d

    zenbin3d

    Joined:
    Jul 7, 2023
    Posts:
    11
    Wow! That's awesome news!
    Do you have a general idea of when you'll want to release the update / new asset?
     
    Last edited: Sep 18, 2023