Realtime Cut


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

Cuttable Mesh

The Cuttable Mesh script found in the Add Component > MAGES > Mesh Deformations > Cuttable Mesh menu enables realtime seperation of a mesh along a plane. It can be used in combination with the Cutter script or as a standalone by simply calling the public void Cut(Plane cutPlane, out Mesh positiveSide, out Mesh negativeSide) method. By attaching the script in a GameObject that containts a Renderer component you get the following options:

Cuttable Mesh Inspector, showing the handleMeshReconstruction property



bool handleMeshReconstruction

Leave the cuttable script create the two gameobjects the one containing the positive side of the mesh and the other the negative side. This works by just copying the original gameobject and attaching the new mesh in each side. Disable it if you want to handle the reconstruction of the mesh yourself after calling the Cut method.


The Cutter script, found in the Add Component > MAGES > Mesh Deformations > Cutter menu, is a simple example script showing how to use the CuttableMesh. It can be attached in a gameobject that you want to act as a knife splitting the mesh in two parts. In order for the Cutter, to work we must have a trigger collider in the knife at the position of the blade and a collider (trigger or not) in the gameobject having the CuttableMesh script attached to it. These colliders will be used in order to detect the moment the knife enters the Cuttable Mesh and the moment it exits. We keep track of 3 points, two points on enter and one point on exit, in order to define the cutPlane.

By attaching the Cutter script to a gameobject you get the following properties:

The cutter inspector, having two fields for selecting two points on the tool to act as a blade.



CutSegment cutSegment

Defines the two points that will be used to create the cutPlane. Adjust them to match your blade’s edges.


Instead of manually setting the cutSegment’s points you can use the two handles that appear in the scene. Make sure you have the editor Gizmos option enabled. If the handles do not show, they may be on the same point as the default move handle for this gameobject. If that is the case, simply select the hand tool in the editor in order to hand the default move tool and make the handles visible.

The gizmos that appear in the scene for setting the CutSegment points