The tear module enables the developer to set up a Unity gameObject as scalpel / knife tool, in order to cut segments of rigged and static models in real time.

Set up

To use the Tear Module, you need to attach the Tear component onto the gameobject that you want to use as a scalpel / knife. Simply click Add Component> MAGES > Mesh Deformations > Tear to add the component.


This gives you the following properties:

  1. LineSegment tearSegment

    Option to set up the Tear Line Segment.

    For easy setup you can click the edit button in the inspector as seen below


    And use the handles shown in the scene to make the green point match the blade’s lower edge and the red point match the blade’s upper edge as shown in the picture below.



    Make sure Gizmos are enabled on the Unity editor.

  2. float tearPerformDistance

    The length of each tear when continuous tearring is performed.


    Decreasing this length will make for smoother curves in the tear line but needs more performance.

  1. alpha:

    Option to set how much will the tear segment be opened.



    Tear with small alpha.


    Tear with big alpha.


    If the alpha is set to a huge value, then the tear can sometimes show some artifacts.

That last step that remains is to add a trigger collider component to the gameObject, that is aligned with the tear segment that we created before and as a result it’s also aligned with the blade. This will be used to check when a tear should be performed.

In our example we are going to add a Box Collider.




LineSegment tearSegment

The line segment based on which the tear will be performed.

float tearPerformDistance

The tear length of each individual tear in a continuous movement.

float alpha

Determines how wide the tear segment will appear, as in how much it will be “stretched”

UnityEvent OnTearPerformed

Called after this script successfully modifies a mesh section.