I suppose it depends on exactly what you are after, but a simple technique would be to have no forces or gravity acting on a pre-shattered cloth then animate the position of a volume axis field so it encompasses the object. So for example it might be an upward force inside the volume axis field and you just move it so it intersects the parts you want to peel off.
The shattering could be done by selecting all the edges you wish to tear along then doing doing detach component before making the mesh cloth.
If you wanted to make it like something sticking to a surface that is peeling off then you could perhaps additionally collide with the original non-shattered mesh, making it a passive collider and on the nRigid node set the forceField to create a slight clinging force near the surface (keep fieldDistance small).
Another approach is to lock the cloth using inputAttract and then animate the inputAttract per vertex. This is a little tricky to do, but the following works:
-
Create a volumeAxis field affecting the cloth
-
Set inputAttract to 1.5 and set inputAttractMapType to Per-Vertex
-
Create a custom array attribute on the cloth (lets call it inputA):
addAttr -ln “inputA” -dt doubleArray nClothShape1;
setAttr -e-keyable true nClothShape1.inputA;
- Set up a particle creation and runtime expression for the nCloth
dynExpression -s “inputA = 1;” -c nClothShape1;
dynExpression -s “if( inputForce[0] != 0 ){
inputA = 0;
}” -rbd nClothShape1;
One can use particle expressions in a limited fashion with nCloth, because it is derived from the particle class. These expressions set inputA to 1 at the start frame and zero when the field strength is not zero.
- With a regular non-particle expression copy the array inputA to the inputAttractPerVertex array. We do this by connecting and disconnecting the attributes. We can’t simply leave it connected or directly set the per vertex array inside the particle expression, as this leads to a dependency graph loop that blocks evaluation of the cloth.
expression -s “connectAttr nClothShape1.inputA nClothShape1.inputAttractPerVertex;
disconnectAttr nClothShape1.inputA nClothShape1.inputAttractPerVertex;” -o pSphere1 -ae 1 -uc all ;
Once this is done the cloth will be locked to the input mesh position(even if it animates) until the volume axis field overlaps it, after which it is free to move with forces.
I’ve attached a simple scene showing this technique.
If you want to have smooth normals you could do a merge vertex followed by smooth normals on the output cloth mesh. (that’s basically what the tearable constraint does)