Search Unity

Simple Fracture Script [v 1.01]

Discussion in 'Made With Unity' started by •BTM, Aug 20, 2010.

  1. a.callum

    a.callum

    Joined:
    Apr 24, 2011
    Posts:
    5
    Hi, I'm currently testing out your script I've been wanting to do something like this for a while. However I am not really sure I understand how to piece it all together.

    Do I apply the script to each object I want to fracture? I am not sure how to use the function you posted to call it from a script.

    Also I am receiving these errors when just importing an compiling (no other settings/touching anything):

    Any help would be greatly appreciated!
    Thanks
     
  2. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574




    Go back one page and you would have found the answer ;)




     
  3. a.callum

    a.callum

    Joined:
    Apr 24, 2011
    Posts:
    5
    Thank you indeed, I must have completely glanced over the important posts on that page. However, I am now receiving a different error:

    This appears to be the same as someone's post just above mine. Any ideas how to fix this? Using Unity 3.4
     
  4. SanX

    SanX

    Joined:
    Nov 27, 2010
    Posts:
    32
    Just add these "" to this -> newObject.GetComponent(SimpleFracture).Fracture(point,force,iterations);

    Like this:
    Code (csharp):
    1. newObject.GetComponent("SimpleFracture").Fracture(point,force,iterations);
    I dont know will this work, but the error messages will go away...
     
  5. vinoful

    vinoful

    Joined:
    Aug 25, 2011
    Posts:
    3
    Hi all ,

    Good Day,

    Thank you for all the ideas posted here,

    I would like to know is tht possible to cut the trees in the terrain , It will be really helpful for my learning process.

    Thank You


     
  6. clockwork_fromage

    clockwork_fromage

    Joined:
    Aug 2, 2011
    Posts:
    13
    i've run into a little snag that i would need your help with , im trying to put your script on each of a large grid of cubes and the big problem is that they all need to be mesh colliders instead of box but this takes massive amounts of memory compared to box colliders , do you think there would be a way to make box colliders turn to mesh the moment they get hit or would that go against the way colliders are made ?

    also , broken pieces of an object dont collide with the original piece and in a grid made of the same block instanciated over and over they just seem to fall straight trough the whole grid since their all the original piece , any idea for this ?


    edit , actualy nevermind about the mesh collider thing turns out theyr not that heavy i just ad a heavy shader on them by mistake
     
    Last edited: Sep 7, 2011
  7. Benproductions1

    Benproductions1

    Joined:
    May 11, 2011
    Posts:
    63
    Sorry to say, but I'm using unity 3.4.0 and am getting compiler errors from your script.

    This error appears four times:
    Assets/Scripts/simplefracture_163(1).js(134,96): BCE0005: Unknown identifier: 'SimpleFracture'.

    I tried renaming the script to SimpleFracture but gave me more errors. :(

    BTW love your demo. It's little things like this, that make games awsome!!! :D
    If only they worked...

    happy coding...
    Benproductions1
     
  8. •BTM

    •BTM

    Joined:
    Jun 6, 2010
    Posts:
    108
    I'm aware that there are problems with the script in 3.4, on top of some existing problems and limitations in the posted version. I might resurrect it for an idea of mine; hopefully I'll find the time to make an update for the script in the near future. If I do, I'll make some much needed improvements on it simultaneously.
     
  9. clockwork_fromage

    clockwork_fromage

    Joined:
    Aug 2, 2011
    Posts:
    13
    that would be great , your script is very useful and gives amazing results i must have read it 15 times to make sure i get everything going on in there , if i may make a suggestion , ive been trying to add force based on the fracture's force but i havent really got it to work yet , now the pieces just fall straight down which is pretty boring
     
  10. xdgabzxd

    xdgabzxd

    Joined:
    Sep 25, 2011
    Posts:
    1
    Hey man, siicckk script! I was wondering, how did you make the brown walls that are used in the demo thing of this? I tried making a cube with a rigid body but all the parts are rubbish and fly away when shot. Help please? Or maybe release the link to the demo project as a folder so i can look at it on there? Thanks :)
     
  11. feloxy

    feloxy

    Joined:
    Jul 30, 2009
    Posts:
    338
    Hey just wanted to say DUDE YOUR SO AWESOME ! gonna try this when i get home.
     
  12. disturbing

    disturbing

    Joined:
    Dec 12, 2010
    Posts:
    127
    I think you would love nvidia apex. Would be interesting if we can implement that for destruction in Unity.
     
  13. teddylau168

    teddylau168

    Joined:
    Nov 15, 2011
    Posts:
    1
    I am using Unity3.4 ! i am waiting :(
     
  14. eskielsantana

    eskielsantana

    Joined:
    Sep 6, 2011
    Posts:
    11
    I am also very anxious waiting since we also use the Unity3.4 xD
     
  15. pitbull2080

    pitbull2080

    Joined:
    Dec 4, 2011
    Posts:
    1
    hi guys , i have a problem with this script.
    i dont know how to call the script to cut the object and where i have to assign the script, on the object or on the cutter.

    to resume i have a cutter and i want that he fracture a 3d cow when i press "space button"
    i'm running on unity 3.1 and i have corrected all the script errors.

    so please how can i call this script from another script?

    thank you
     
  16. lee74saurusr3x

    lee74saurusr3x

    Joined:
    Mar 21, 2011
    Posts:
    31
    Wow. This is absolutely amazing. Someone could easily turn this into something equal to or even better than battlefield type destruction. Great work man.
     
  17. rtumelty

    rtumelty

    Joined:
    Dec 11, 2011
    Posts:
    12
    Hi, first post on the Unity forums. I updated the script for Unity 3.4, hope you don't mind! I've not adjusted any functionality, just changed it enough so it'll work with the new Unity. If anyone's looking for it, I've posted it here:

    http://pastebin.com/CkT4Sfp6
     
  18. Nhomme-Beurre-One

    Nhomme-Beurre-One

    Joined:
    Aug 18, 2011
    Posts:
    10
    Hello,

    I was wondering if it works in Unity 3.5 and if yes how to you make it work ?
     
  19. *ShiNe

    *ShiNe

    Guest

    Joined:
    Dec 9, 2009
    Posts:
    17
    Hey. I've edited it a bit so it's now working for me with 3.5
     

    Attached Files:

  20. MrGoodKill

    MrGoodKill

    Joined:
    Apr 24, 2012
    Posts:
    1
    Yop.

    I know many people already asked but could someone explain, even briefly, how to use that script? I'm new to Unity 3D but it looks so F***ing awesome i'd like to know how to implement it in future games.
    I guess we have to import the script as an asset in a unity project but what then?
    I tried adding the script to the fps controller and to a mesh colider but it didn't work. It may seem silly but i have no idea how to make it work thank's i don't script.

    Thank you very much ;).
     
  21. jasonwupilly

    jasonwupilly

    Joined:
    Jul 30, 2012
    Posts:
    2
    Hey guys, if any of you guys use this, does anybody know good settings to simulate glass breaking?
     
  22. cupsster

    cupsster

    Joined:
    Apr 14, 2009
    Posts:
    363
    Thankx for sharing code! Will test it for sure when I will have time cause I was searching for some example like this while ago.
     
  23. Mrkanghoo

    Mrkanghoo

    Joined:
    Dec 22, 2012
    Posts:
    8
    Hi! I'm beginner.i just want to cut the cube.how i got it?
    thank.
     
  24. RetepTrun

    RetepTrun

    Joined:
    Jul 31, 2011
    Posts:
    9
    Thankyou ShiNe finally I can use this script again XD


    I see some people dont know how to use it.
    You make an object in a 3d program, (in blender I just made an icosphere). Import it to unity.
    Add the script to it
    Add a mesh collider, set to convex
    Add a rigidbody
    Move the object up a bit high and start the scene to see it drop an break

    I found it does not work good with basic unity objects, dont just create a cube in unity, use objects from another program that are a bit more complex. Convex mesh collider only. Dont put it on a parent object, put it on the thing with the mesh.
     
    Last edited: Jan 10, 2013
  25. GaryDoo

    GaryDoo

    Joined:
    Jan 27, 2013
    Posts:
    1
    Hi, I'm not sure what I'm doing wrong here but I'm not getting the nice effect that everyone else is!!! I'm doing a 3d logo imported from blender, I wanted a sphere hit it from behind and fracture it...it just looks like it got steam rolled and then all fractures gather together and bounce around the plane..i'm using unity 4, anyone with any ideas?
     
  26. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Hmm tried the script, and I can get the object to break.......which is cool :) However, a big drawback was that my game fps dipped down to 17 fps with a noticeable long pause in the game flow. I am using Unity 4 as well.

    Not sure if it can be optimized (besides lowering some settings) in order to get manageable fps rates when breaking?
     
  27. unityuser94

    unityuser94

    Joined:
    Mar 29, 2013
    Posts:
    39
    Using it on lower poly mesh's really helps keep the fps from dropping, as I have discovered.
     
  28. Brendo-Vdm

    Brendo-Vdm

    Joined:
    Sep 20, 2012
    Posts:
    19
    how to call the break ?
     
  29. jalain

    jalain

    Joined:
    Jan 2, 2013
    Posts:
    3
    Hi there, I have tried your script and loving it, but I will like to use your script for exploding barrels or destroy crate. I was unable to find a solution to how can I have your script works when I click on the crates or the barrels and to have it explode in pieces from the center. I have tried to apply a rigidbody force when mouse down but it only moving the box in the x, y, z axis. I am a beginner with javascript so help will be cool. So I will like when I click on my object apply a force from the center of the object for a exploding barrel or to have the crate broke and collapse. For now, I want to try only with the mouse click, later the goal is to have my barrel or crate broke when player hit it with a weapon.

    Thank you!
     
  30. kakuridoji

    kakuridoji

    Joined:
    Apr 30, 2013
    Posts:
    1
    plz gimme the gun script i've been looking for one for ages
     
  31. Yguinhoxp

    Yguinhoxp

    Joined:
    Apr 7, 2013
    Posts:
    4
    youtube tutorial please...
     
  32. Zortor

    Zortor

    Joined:
    May 8, 2013
    Posts:
    2
    If anyone interested, I made a simple conversion in C# of the script, I'll clean it and share it as soon it is ready
     
  33. Zortor

    Zortor

    Joined:
    May 8, 2013
    Posts:
    2
  34. elbeau

    elbeau

    Joined:
    Jul 11, 2012
    Posts:
    1
    I can't see anything in this thread or in the downloads that specifies a license. Can this be used and/or modified royalty-free in a commercial product?
     
  35. Marde

    Marde

    Joined:
    May 15, 2011
    Posts:
    32
    About the C# Script:
    Thank you for the translation Zortor!
    First I had problems to find the missing setup because the objects did not fracture. I had to define the grain (in the inspector or script) so the script worked fine. I hope this information can help some people. I hope I can improve the performance in the next days, although this fracture algorithm is not the best available.
     
  36. JJDeveloper

    JJDeveloper

    Joined:
    Jul 6, 2014
    Posts:
    33
    Where can I get this script? I see no working link...
     
  37. MrJohny

    MrJohny

    Joined:
    Feb 19, 2015
    Posts:
    73
    blind guy detected