New Updated Version! Scroll down to the webplayer if you just want to try it out.
A couple of weeks ago I got the idea, that I wanted to try and create a small prototype where you could cut a mesh into two pieces procedurally. Initially I thought a weekend would be enough to explore this idea, just creating a rough proof of concept. This whole idea was a lot more complex than I initially thought. On the surface it seems simple, split the mesh into two meshes based on some sort of a cut, cap the open end of the meshes, and create two new objects instead of the old one.
I created my tech demo in Unity3D, using the standard free license. The demo contains a highly reflective metal ball and a wooden cube. Objects are sliced by a cutting plane, and it can cut all convex object as it is now. The cube and sphere contains the same components, with the only difference being their mesh and material. The character is a rigidbody so you can affect the objects in the scene, and velocity is carried over to the new objects. Try making a few slices and then run into the object, or first run into the object to make it move and then slice it while it’s in motion…
New improved version. Now only one object at a time for better performance. You can clean op the old object(s) and spawn a new by pressing 1-5. 5 different objects and several different materials that can be cycled through by using Q or E. Object number 5 is a melon, the uv mapping works when making a clean slice but still needs work on subsequent slices. Cubemapped materials has a bug because of unity batching meshes together, so they only work when viewing a single piece of the mesh at a time.
Slicing Tech Demo:
To slice hold down Space, then press down left mouse button, drag your slicing line, and release the button.
WASD – Move
Mouse – Look
Space – Freeze movement and prepare slice.
LMB and Mouse drag – Slice
1-5 – Spawn new object and clean up old pieces. (Cube, Sphere, Cylinder, Table, Melon)
Q/E – Switch Material