Cutting mesh in realtime

Kala J picture Kala J · Oct 24, 2013 · Viewed 22.1k times · Source

I want to slice a mesh object into at least five parts. I've done some research and some people on here have cloned objects when sliced and just instantiate two objects from a single slice?

I'm pretty new to Unity and C#. So any beginner tutorials on where to start or where I can read for learning how to cut mesh would be nice. Like what functions/methods should I be looking into? What methodology is behind cutting mesh?

From my understanding, I haven't seen any tutorial or asset that actually cuts triangular mesh? If there is, how is it done? What is the logic behind it? I guess I need help understanding the logic behind it and how to get started or what I should look into?

Cut mesh in realtime I mean.

EDIT:

Attempt at understanding and playing around with code:

I used the fake slicer 3.0 (http://unitycoder.com/blog/2011/08/09/fake-mesh-slicer-v3-0/) and included in the sample, they have a capsule that the slicer works on.

If I added a cube or another capsule with rigidbodies properties and collider property, the slicer (aka plane) only clones the object and doesn't slice it off. Why is that? How can I manipulate the code above to work for all kinds of objects?

I get this console error and I don't know what it means:

UnasssignedReferenceException: The variable cutplane of 'Slice_mesh3_js' has not been assigned. You probably need to assign the cutplane variable of the Slice_mesh3_js script in the inspector. 

Answer

VicM picture VicM · Oct 29, 2013

Have you tried the turbo slicer asset?

https://www.assetstore.unity3d.com/#/content/4169 There is a demo in their website.

There are ways to achieve what you want, however the noted asset could be the easiest one.

Worth looking assets for slicing, breaking apart:

Also you can:

  1. Use your preferred modeling program and model the object in parts and with an animation slice the object as a result of certain action.
  2. Programmatically disappear the complete object and appear the slices using maybe a particle system to improve the effect.