Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

What is the most efficient way to break a single mesh into many objects?

Discussion in 'Physics' started by SoundStormLabs, Jun 23, 2018.

  1. SoundStormLabs

    SoundStormLabs

    Joined:
    May 6, 2017
    Posts:
    187
    There's some uses for digging dirt or chipping stone away or breaking any other object. Although dirt is somewhat granulated or stone and glass could be made of millions of small imperfections, it seems impractical to have the billions upon billions of small objects that simulate the processed at once. How can Unity deal with simulating the breaking of a large mesh into much smaller specific discrete pieces like dirt only at a local area of impact?

    Firstly, I was thinking maybe there is some kind of swap method where part of a large mesh can be swapped with one that has an indentation in it, but can that be done all on one mesh that isn't rigged? It doesn't solve the problem of digging further into the area you already dug to continue the process.

    Secondly, I was thinking a "wall" of armature bones could lay close to the surface in a grid-like manner, though that would still leave the problem of having millions of objects. When a person digs, it deforms or moves back in a predictable way and you can have a generated particle with a size equal to the translation of a bone fly away from the point of impact. In this instance though, you're still creating millions of objects that your game has to keep track of on real time, or I guess maybe only thousands depending on how accurately the digging is simulated.

    Thirdly, you could compromise with time intervals, though it means you'd have to restructure the rest of your game around doing so to avoid that process being mechanically inconsistent. You could break the ground up into larger objects, and simply say after a specific interval of time, it disappears, though also at the expense of controlling what is done with the dirt or rock in real time.

    Fourthly, you could maybe have some kind of...mesh mask at an area of contact, but then you would have the problem of having nothing to render behind the vertices of the mesh you just masked.