Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    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:
    152
    Ok, this issue was fixed.
    In build 1.16 small objects should be fragmented without problems.
     
  2. songpwc

    songpwc

    Joined:
    Nov 6, 2018
    Posts:
    14
    @Mir-vadim
    hi great asset . do you have skinnedmesh runtime slice and demolition demo video. I am not sure how it looks like. can this slice arm, leg vertically and horizontally?
    thanks.
     
  3. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Hi, right now skinned mesh fragmentation and slicing not supported in Runtime. It could be done but for now it is not optimized for Runtime usage. Usually skinned meshes are mid\hi poly and has issues like open edges and interpenetrations. And such issues can not be handled well by our sensitive Runtime fragmentation mode, it needs simple and clean meshes without issues so it won't need to spend time on checking and fixing issues.
    For such meshes should be used Editor fragmentation mode which is slower but much more robust.
    Also slicing skinned meshes needs some additional support like proper riging after fragmentation so this feature is in our TODO list for now.
     
  4. songpwc

    songpwc

    Joined:
    Nov 6, 2018
    Posts:
    14
    @Mir-vadim
    thank you for your quick reply.
    The release note is a little bit misleading.
    " - Rigid. New SkinnedMesh Object type. Support for runtime demolition and slicing of SkinnedMesh objects."

    anyway, I am going to wait for this feature.
     
  5. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Yeah, sorry, I will edit this note.
     
  6. Rmzn0

    Rmzn0

    Joined:
    Jul 24, 2018
    Posts:
    9

    Is there any progress?
     
  7. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Hi, sorry, for some reason sometimes I get notifications about new posts and sometimes not. Also after I launched Discord channel people ask more questions there: https://discord.gg/8G98JKj

    As for your questions, weel I started to work on such tutorial, downloaded one of popular tool but I had some problems with it, Rider couldn't open project right, ate like 10 GIGs of RAM and then it was impossible to work further, it was impossible to find out where to inject RayFire code to make it work, and while I was trying to figure out what is wrong other users asked to add and/or fix something, and we had some problems with adding Mac support. So, long stroy short, I simplu forgot to continue with this tutorial and actually since then we added a bunch of new features so for now I have to recreate some old video tutorials because they become obsolete. Sorry again, but last month was really busy, I will start working on tutorial you asked tomorrow. I guess with other FPS project.

    Also, few days ago we finally compiled first build with Mac support, without multithreading support yet, but we are adding it right now. So, if anyone wants to test new build on Mac just let me know, but better to do this in Discord.
     
  8. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    537
    Beautiful asset, thanks!

    Do you have examples of code for use with other shooting systems. Like a function or functions to call and fracture at a given point? I can't find that and your code for the gun component is too much for me. I have a ballistics system in place and need to add that to the hit event of that system.

    Thanks a lot!
     
  9. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Hi, there is method to make a shot.
    public void Shoot (Vector3 shootPosition, Vector3 shootVector)
     
  10. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    537
    Thanks i’ll try!

    best regards!
     
  11. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Build 1.17 with MAC OS X support finally released and available in Asset Store, now we finally can start work on fixing all recent mesh issues. This probably will take 1-2 months.
     
    robotmechanic likes this.
  12. robotmechanic

    robotmechanic

    Joined:
    Dec 29, 2009
    Posts:
    105
    This is an awesome tool! Thanks for making a Unity port!

    One thing I have noticed when using your tool is that the Rayfire Shatter component can break textures after fragmenting. This seems to happen more often when the UV shells are separated and placed all over the UV space. For example, when using atlas mapping. When the UV shell is in one single shell or when the shells are not separated in odd ways, it seems to be fine.

    Is this something that will be addressed in future releases?

    Also, are there some basic do's and don'ts for laying out UVs when used in conjunction with the Shatter Fracture functionality?

    Thanks in advance!
     
  13. seldemirov

    seldemirov

    Joined:
    Nov 6, 2018
    Posts:
    13
    Hi! I try to make the simulation of destruction but my rigid body goes right through object if the speed is high.
    How can I tune my rigid body and other objects for work?

     
  14. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Hi, yeah, we are aware of these issues and right now we are working on fixing them, some should be fixed in next build, but it will be great if you can send us your objects to test, maybe you found something new.
    In some cases you can keep your UV by turning OFF Remove Collinear Vertices propertis in Advanced properties.
     
  15. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Hi, this is something you should tune in Physics Properties.
    Check out this page for more info:https://docs.unity3d.com/Manual/class-PhysicsManager.html
    I guess you need to increase Default Solver Iterations and\or Default Solver Velocity Iterations properties.
     
  16. WildMaN

    WildMaN

    Joined:
    Jan 24, 2013
    Posts:
    50
    Hey, any plans for DOTS (new Entities, meshes and physics) support? I would imagine it's a total rewrite of all c# runtime parts, but it's the future of Unity. DOTS + Havok physics is waaay faster and stable than default solution. I'm a bit hesitant to buy asset right now as it seems not to support DOTS at all.
     
  17. WildMaN

    WildMaN

    Joined:
    Jan 24, 2013
    Posts:
    50
    Also, any chance to get profiler snapshot to evaluate how performant the runtime part is? Core Rigid script, nested/connected clusters and connectivity/unyielding one?

    I'm planning for a mobile game, so performance is of top concern.
     
  18. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Hi, yeah, of course I will add support for DOTS a bit later, for now we are working on fixing fragmentation algorithms to make them more stable and robust. As for profiler snapshot, I think will be better if you will try it on your own, I can send you plugin to test it's performance. In this case you can try it, decide if this is what you need and share your ideas about what can be or should be implemented in better way. Write me personal message if you wan to try it.
     
    one_one likes this.
  19. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  20. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  21. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  22. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  23. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  24. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  25. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  26. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  27. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    537
    Hi there,

    I'm trying to make the system work in my project and , maybe because of my lack of knowledge in this, i can't understand a couple of things.

    I have taken the colum conectivity object from the samples, and i can use the gun component integrated in my ballistics system to blow it up. It works , but at start the column is visible shattered already. Any way to make it look unbroken and only after the first impact be broken?

    Another problem i have is when i try to replicate the column config un a simple unity cube streched like a wall. As soon as it starts the game, the wall blows up because the convex colliders don't fit. I don't know how this works, so sorry if this is to basic, but could you explain it or let me know the steps to do it right?

    Thanks a lot!
     
  28. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    424
    Thanks very much for all the many new videos and it looks awesome and amazing, and also thanks very much for including this in the 50% Spring Sale, although regrettabIy I can not buy it yet.

    This Rayfire is really totally worth it and is really professional shatter and destruction in many different ways

    Love it much that it is available for Unity now and not only for 3D Max

    Seeing the first video about voronoi where it shows that the shatter is made from the point of impact that is very cool, I wonder if:

    1 - SINGLE SHOT - it could be possible to use Rayfire for glass shattering in similar way as seen in this video here below and that some parts near the impact point fall down and keep some of the glass broken bits still together after the shattering as can be seen in the video

    2 - MULTIPLE SHOT - progressive shattering of the glass from progressive different impacts considering the impact point, because as you have shown, is possible to have clusters as seen on your last video above.

    3 - Force (or the speed) of the object impact is considered and calculated by Rayfire to know how big is the shattering?



    I wish you all the best and wish that you sell much during the 50% sale that is available since yesterday and that you keep safe, right and healthy out of any
     
    Last edited: Apr 16, 2020
  29. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Hi, when you say it looks already broken, do you mean it looks broken because fragments wre moved and you see cracks or is this rendering problem?

    I was planning to improve connectivity cluster a bit so it will be possible to start with one solid object and then replace it with connected cluster only when it get damaged or shot, I will try to add such functionality in next build.

    As for scale problem with colliders, there were such issues before and I fixed it, but I guess some bug is still there, can you describe in detail how exactly you created this stretched wall, step by step, when exactly you stretched it?
     
  30. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    537
    Hi,

    thanks for respond. Yes i meant exactly that. The thing is that in the demo scene, the column is perfect, but maybe due to the irregular floor of my scene the column start to compute forces, i don’t know. If you can add that feature, it would be perfect. Thank you so much.

    the stretched cube is the standard. A unity cube, stretched to x-0.5, y-2, z-0.2. Then add the shatter component and do the voronoi basic fracturing. Then i add a rigid component to the root object and set it to inactive and mesh root, same as the column in the samples. Set to connectivity and inpact activation and add an empty unyelding component.
    On play sometimes it tries to explode but the connections maintain the pieces preventing the activation if the offset margin is enough. But you can see almost like a freeze explosion.

    it has no fancy stuff, as you can see.
    Thanks for the help
     
  31. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152

    Hi, thanks. :)

    1. Yes, you can do this by setting simulation type to Inactiv, in this case it is possible to Activate such objects so they start fall down.

    2. You can shoot solid glass object and shatter it relative to point where you shot it, so there will be more tiny fragments but whole glass object will be shatteredafter this. It is also possible to start shoot these fragments and demolish them further if you set depth level to 2. As for runtime clustering, I didn't add such feature yet. For now Clustering do it's job in Awake. I need to optimize it to make it work in Runtime. This is something for future updates.
    But you can prefragments glass, export them in fbx, create same fragments out of this fbx, so all meshes will reference to fbx asset, then setup Cluster and create prefab of this object and then finally define this prefab for Reference demolition in Rigid componenet. So when you will start shoot your object first it will be demolished to this reference and then you can shoot reference itself.

    3. No, for now it uses fragmentation prperties for shattering, but this is a good idea, maybe later I will add option to shatter object based on collision data like velocity and strength.
     
  32. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    I can't reproduce same behaviour, can you put into package your setup before you start Play mode? Also, try to get latest build 1.18, maybe you have older build with not fixed bug.
     
  33. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  34. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    537
    Sure. I’ll send it as soon as i can. I think it is the latest version of the asset store, but i’ll double check

    thanks!
     
  35. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    537
    Hi,

    While i was preparing the sample, i realiced the problem is the mesh is intersecting with the ground.If i rise the column up so it is not touching the ground at start it is looking perfect until the first shoot or impact. So i supose the solution is to have the bottom of the column kinematic always if the re are some parts that needs to be overlapinf other objects, right?
     
  36. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    537
    After further tests i see the gun component always adds force even when the target object has not reached the maximum damage. So i can shoot an object and on each shot, the fragments are moving a bit, not activating, but the wall is deforming slowly after the shots. Maybe it could be good to prevent adding force to the target, if the damage is not at his maximum. Another alternative to the prevoiusly mentioned option to have an intact object until it gets demolished or activated.

    Something like this :

    Code (CSharp):
    1.         void ImpactHit(List<RayfireRigid> rigidList, Vector3 impactPos, Vector3 shootVector, Vector3 impactNormal)
    2.         {
    3.             if (strength > 0)
    4.             {
    5.                 foreach (RayfireRigid scr in rigidList)
    6.                 {
    7.                     if (scr.damage.enable == true)
    8.                     {
    9.                         if (scr.damage.currentDamage >= scr.damage.maxDamage)
    10.                         {
    11.                             if (scr.physics.rigidBody != null && scr.physics.rigidBody.isKinematic == false)
    12.                             {
    13.                                 // Get impact direction TODO average with normal
    14.                                 Vector3 impactDirection = shootVector;
    15.  
    16.                                 // Get impact force
    17.                                 Vector3 impactForce = impactDirection * strength;
    18.  
    19.                                 // Add force
    20.                                 //scrRigid.rigidBody.AddForceAtPosition(impactForce, impactPos, ForceMode.Impulse);
    21.                                 scr.physics.rigidBody.AddForceAtPosition(impactForce, impactPos, ForceMode.VelocityChange);
    22.                             }
    23.                         }
    24.                     }
    25.                 }
    26.             }
    27.         }

    There are some situations when this is not too realistic, but the point is you could have an object, not fractured with one collider and get damage with shots, methods or whatever. Then, when the damage has been reached, the fragmented object, not active yet will replace the previous one. And then on impacts ore something it will be demolished. Thinking on the possible use case of modular walls, you could find a perfect vertical line between the fragmented and the intact neighbour. This gives a bad feeling when playing, as i experimented with other methods of destruction.

    Just some thoughs about this use case in particular. Any idea of how to get the best approach?

    Thanks a lot!
     
    Last edited: Apr 21, 2020
  37. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    What if there will be "Affect Inactive objects" among gun's Impact properties?
    So you will be able to turn it off and this gun will not apply force to Inactive objects.
     
  38. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    537
    It will do, of corse.

    One question, when you have a mesh root with rayfire rigid set to inactive, if you want to use damage, who will receive the damage? Each child chunk or the parent root object? I was trying to confirm my guns were making damage correctly, but the rigid current damage was always 0. Anyway it was working so, i don’t care too much, just wanted to understand it to adapt the gameplay. I’m also trying to have a navmesh obstacle component on the wall modules to prevent the characters to go through the wall, and remove it when demolished or activated, so then the player could go through the fragmented wall. It is a cool effect i already tested, but could be nice to expose an event on demolish or activation or similar states. I can implement that myself, but just wanted to share in case you find a cool adition to your already fantastic system ;)

    best regards
     
  39. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    When you set Mesh Root type all it does is just add in Awake Rigid component with the same properties to every child with Mesh type intead of Mesh Root type.
    Just a quick way to try different properties for a lot of objects.
     
  40. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    537
    I understand, so each child should have his own damage counter in the rigid component. Cool thanks for clarify that.

    Cheers!
     
  41. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    359
    Just purchased the asset and after trying the demo scenes I realize the objects seem to fracture in their entirety when they break. Is it possible to only break off parts?

    For example, when hitting a wooden fence I don't want all of it to fracture and fall apart right away. I'd like for the area around the impact point to break off but the rest of the model should stay intact.

    How can I do this?

    Also, why is the mass limited to 400? I have to handle physics for both small (rocks, bricks) objects in my game but also large cranes and buildings. I must admit I'm still having issues grasping how unity expect us to handle the mass of different objects... the physics just doesn't want to behave at times. Walking into a car shouldn't make it fly off across the map... dammit. WHY! YOU PHYSX!

    BTW congrats on your asset its an awesome product.

    Anyone still wondering if they should get it, stop thinking about it. It's as good as it looks and you are going to bite your fingers off for missing the sale!

    Fred.
     
  42. ChoChick

    ChoChick

    Joined:
    Jul 18, 2016
    Posts:
    39
    I want to turn rayfire rigid collider on / off from a script like collider.enabled.
    Is there a way to access the Rayfire Rigid Collider?
     
  43. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    You can access it in this way:

    Code (CSharp):
    1. RayfireRigid rigid = gameObject.AddComponent<RayfireRigid>();
    2. rigid.physics.meshCollider.enabled = false;
     
    ChoChick likes this.
  44. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Hi, unfortunatelly there is no such support yet. We use Voronoi diagram for fragmentation and it has to fragment whole object. There is Clustering feature in Shatter component which glue together groups of fragments to make them look more complex, but for now it doesn't optimize glued outer surface. We are going to write surface optimization first and then add some way to cut holes in objects, object still will be fragmented into fragments to get fragments which you want to cut off and then the rest of fragments will be glued back to solid object. And then hopefully we will try to add boolean operations, but this is something not for near future.

    Mass was limited because with higher mass you will start get weird simulation, for the same reason it shouldn't be less than 0.1 if possible. Anyway, this is something you can easily edit by yourself. Open RayFire/Scripts/Classes/RFPhysics.cs and change range to whatever you need in line 41.

    And thanks, you are welcome to write the same in review, this really helps to make it more noticeable for other users ;)
     
  45. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    359
    Oh I see, if the entire object needs to fracture at the same time, as long as they don't move at all we shouldn't see the fracture. I did a crude destructible wall once with cubes that I perfectly aligned with no overlap/gaps and you couldn't see the cracks. On collision, I unchecked "kinetic" on the concerned cubes and it let them fall off individually, leaving the rest of the wall looking intact. Something similar may work here.

    Regarding the mass, I already modified the code to allow up to 10000 (had to modify two lines) it works fine but as you said I will probably run into weird behaviours. I will have to read more on the subject.

    BTW I love that demo with the 2 rocks falling on a slab that slowly gets "kinda" bent down with the weight. Since you're already knee-deep into mesh manipulations are there any future plans for a "deformation" feature/addon? That would be epic.
     
    Last edited: Apr 30, 2020
  46. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
    Hi, during next 2-3 months we are going to add ios support (which is almost finished), android support, improve fragmentation algorithms even more and add a bunch of other minor features and improvements.
     
  47. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  48. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  49. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
  50. Mir-vadim

    Mir-vadim

    Joined:
    Apr 18, 2017
    Posts:
    152
unityunity