Cut¶
The cut operator splits the mesh into two separate parts based on a defined plane, discarding the mesh on the left handside of the plane.
We will demonstrate this by starting from a simple interactable item:
Add the Cut component to your item by clicking Add Component → MAGES → Mesh Deformations → Cut. This will add the following component to your object.
Click the button as shown below to enable the cut plane adjust tool.
Warning
In order to be able to see the handles the Editor Gizmos must be enabled.
Use the handles in the scene to adjust the cut plane to match the visual blade of the tool as shown below.
The size of the plane is shown only for visual fidelity and is not used at all for calculations. The plane in reality expands infinitely.
Note
By hovering your mouse over the Cut Plane Adjust tool in the Unity toolbar you can see the tool key binds used for rotation (Hold Shift) and movement toggle.
Add a trigger collider ( Box in this case ) to match the blade shape. This will be used to perform the cut when a deformable mesh enters the trigger.
That’s it! The Cut script will now automatically slice any deformable mesh that it can intersect. To cut a mesh manually, you can call the “PerformCut” method:
PerformCut(DeformableMesh target)
Properties¶
Property |
Description |
|
The cut plane. The part of the mesh on that left-hand side will be sliced and discarded upon use. |
|
Invert the cutting direction to the opposite side of the plane. The same thing can be accomplished by rotating the plane 180 degrees around it’s base axis |
|
Called whenever this cut script successfully modified a mesh section. |