Realtime Cut

Warning

Note that this feature is in experimental stage, therefore it is not stable and it can create artifacts on the newly created meshes.

MAGES gives you the ability to perform realitme cuts in meshes, by providing a Cuttable Mesh and a Cutter script. A combination of these can achieve results like the following:

Simple Cut Performed on a Cube

In this tutorial we will demonstrate how to setup the cube as a cuttable mesh and how to setup a custom cutter.

Cuttable Mesh

First drag and drop the mesh you want to setup as cuttable in the scene (The box in this case). Then go to Add Component > MAGES > Mesh Deformations > Cuttable Mesh and add the Cuttable Mesh script to the object.

The add Component Menu in the Mesh Deformations Category.

This will expose the following properties and you will set them as below:

The inspector of the cuttable mesh.

The final step to complete setup is to add a collider containing our mesh (either trigger or not).

../../../_images/TriggerColliderBox.png

Note

This step is optional if you want to use the Cuttable Mesh by calling the public void Cut(Plane cutPlane, out Mesh positiveSide, out Mesh negativeSide) function from a custom script, instead of using the Cutter script described below.

Cutter

First drag and drop the tool you will use to cut the mesh (here we will use a knife). Then go to Add Component > MAGES > Mesh Deformations > Cutter and add the Cutter script to the tool.

The add Component Menu in the Mesh Deformations Category.

This will expose the following properties:

The inspector of the cutter.

We will then (1) click the hand tool to hide the unity tool gizmos and then (2) move the two handles to match the knife’s blade.

The gizmos for setting the cut tool blade segment.

The final step to complete the setup is to add a trigger collider containing the blade of the knife.

../../../_images/TriggerColliderTool.png

You can now use the knife to cut any Cuttable Mesh.