Hi,
I’m now trying to implement/modify/create all the possible interactions (cutting, grasping, tearing, pushing, suturing…) in iMSTK-Unity. But now, I’m going to focus on cutting and tearing, the ones that modify the mesh deleting/adding vertices.
I’m currently using iMSTK-Unity main-version-2 and iMSTK main branch (Don’t know the exact version, but not older than 15/20 days).
(PLEASE LET ME ADD MORE THAN ONE PICTURE AND MORE OF TWO LINKS)
--------------------------------------------------------CUTTING--------------------------------------------------------
I created cutting.cs just like:
cutting = new Imstk.PbdObjectCutting(pbdModel.GetDynamicObject() as Imstk.PbdObject, rigidModel.GetDynamicObject() as Imstk.CollidingObject);
And, when a button is pressed, i just call to cutting.apply.
https:// youtu.be/Ic9TxnOObD4
Using the gizmos I’ve seen the following facts:
- 4 new vertex are always created
- The vertex are not connected in the correct order (image)
- Splitting the old cut vertex in two vertex, and connecting them to the correct “neighbor” should be enough.
pd: theoretical, not theorical, sorry.
The image is a cut linemesh that was created from vertex number 4, to vertex number 0, with 4 segments, so, with vertex {0,1,2,3,4}
There is also a not important (for now) “bug” that causes an error in the normals calculation. The explanation is in iMSTK gitlab issues, I’m not gonna write it here because is not important.
--------------------------------------------------------TEARING------------------------------------------------------------
Using tearing.cs script that is in main-version-2, I’ve broken the mesh, but constraints are not totally broken. I can see that they are broken because I can puncture with a needle and the cloth offers no resistance, but the particles are still wirking together like a cloth. Video right there:
https:// youtu.be/v-9IkNYqXfg (Let me add links please :,) )
The modification i did to achieve this (visual holes) is just updating the mesh indices with the physics mesh indices, like this:
Imstk.SurfaceMesh physicsGeom = Imstk.Utils.CastTo<Imstk.SurfaceMesh>(GetPhysicsGeometry());
meshFilter.mesh.vertices = MathUtil.ToVector3Array(physicsGeom.getVertexPositions());
int[] indices = MathUtil.ToIntArray(physicsGeom.getTriangleIndices());
meshFilter.mesh.SetIndices(indices, MeshTopology.Triangles, 0);