Tear¶
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:
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.
Note
Make sure Gizmos are enabled on the Unity editor.
float tearPerformDistance
The length of each tear when continuous tearring is performed.
Warning
Decreasing this length will make for smoother curves in the tear line but needs more performance.
alpha:
Option to set how much will the tear segment be opened.
Example:
Warning
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
.
Properties¶
Property |
Description |
|
The line segment based on which the tear will be performed. |
|
The tear length of each individual tear in a continuous movement. |
|
Determines how wide the tear segment will appear, as in how much it will be “stretched” |
|
Called after this script successfully modifies a mesh section. |