Realtime Tear¶
Warning
Note that this feature is in experimental stage, therefore it is not stable and it can create artifacts on the newly created mesh.
MAGES gives you the ability to perform realitme tears in meshes, by providing a Tearable Mesh and a Tearer script. A combination of these can achieve results like the following:
In this tutorial we will demonstrate how to setup a softbody bunny as a tearable mesh as well as how to setup a scalpel to perform the tear.
Tearable Mesh¶
First drag and drop the BunnySoft prefab located in Packages > ORamaVR MAGES SDK > Runtime > SDKAddons > Softbodies > Examples > Bunny into the scene. Then go to Add Component > MAGES > Mesh Deformations > Tearable Mesh and add the Tearable Mesh script to the object.
This will expose the following properties and you will set them as below:
If you do not use the bunny prefab you can set the float editFragmentScaleFactor
to 0 and figure it out later when you will have the tearer setup.
The bool useWithSoftbodies
option will be available only if the tearer is attached in a softbody, and when selected it will enable tearing of the underlying softbody particle
connections in addition to the mesh.
The final step to complete setup is to add a trigger collider containing our mesh.
Note
This step is optional if you want to use the Tearable Mesh by calling the Tear functions from a custom script, instead of using the Tearer script described below.
Tearer¶
First drag and drop the tool you will use to tear the mesh (here we will use a scalpel). Then go to Add Component > MAGES > Mesh Deformations > Tearer and add the Tearer script to the tool.
This will expose the following properties:
You will then (1) click the hand tool to hide the unity tool gizmos and then (2) move the two handles to match the scalpel’s blade.
You can modify the width and the length of each tear segment in the tearer script according to your needs.
The final step to complete the setup is to add a trigger collider containing the blade of the knife.
You can now use the scalpel to tear any Tearable Mesh.