Search Unity

Shattering game objects

Discussion in 'General Discussion' started by elzbeb, Dec 22, 2020.

  1. elzbeb

    elzbeb

    Joined:
    Jul 30, 2020
    Posts:
    54
    Hello so I want to know how can I shatter/destroy game objects without an addon in the unity store, (because I don't want to spend money and because it's not urgent) I heard of mesh slicing of something of that sort so I would like to know how would I be able to do that here is an example of what I want to recreate

    Hope anyone can help I know its complicated but anything would really help as I can't find anything.
     
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    You can't do it properly without an addon in unity engine. (You'll need Nvidia Blast)

    To do it "not properly", you'll need to either assemble object from physical objects connected to each other with breakable constraints, or once the object is hit, replace it with a "broken" copy of it assembled in same shape. For many scenarios that would be enough.
     
  3. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    We were using fracture plugin in blender to divide object (tower) into chunks.
    Later in game we substituted tower into tower made of this chunks with attached colliders and rigidbodies.
    Physics did the rest.

    You might need to scale a little this colliders since it can explode.
     
  4. elzbeb

    elzbeb

    Joined:
    Jul 30, 2020
    Posts:
    54
    i already have that i have a model of a broken building in blender and I instantiate it when the ball hits the building but that's not how i want it I want to only break the part that the ball hit without showing that the whole building is broken
     
  5. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    That's not quite what I've described.

    It is not enough to just spawn broken pieces. You'd need to connect them to each other with fixed joints and make constraints breakable. This way it won't all explode at once.
     
  6. elzbeb

    elzbeb

    Joined:
    Jul 30, 2020
    Posts:
    54
    Thats what i have, a broken version of the building in blender that i did using the cell fracture plugin and instantiate the prefab when the ball touches the building but its not how the game does it, when the ball touches the building only the pieces in the blast radius get "instantiated"
     
  7. elzbeb

    elzbeb

    Joined:
    Jul 30, 2020
    Posts:
    54
    oh, I get it i am starting to understand the mechanics behind this, is there any tutorial or post on this for further explanation?
     
  8. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    There's Physics Joint article in the manual:
    https://docs.unity3d.com/Manual/Joints.html

    Beyond that just put two rigid bodies into scene and experiment.

    There might be a tutorial, but I don't see a point in looking for one. It is something you can try/test very quickly.
     
  9. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769