18-12-2020, 09:09 AM
(This post was last modified: 18-12-2020, 09:10 AM by josemendez.)
(17-12-2020, 02:13 PM)IT_Tao Wrote: Hi,
I'l using the Obi Cloth in my project, and I'd need to cut the cloth I've created. I use a mesh forming a long sheet, and I need to cut it in two parts, following a precise line of vertices (I can get their indices). Is there a way for me to do so, or do I have to find another solution?
Thanks !
Hi there,
ObiTearableCloth has a Tear() method, that takes a StructuralConstraint as input. A structural constraint is a struct that contains a reference to a distance constraint batch, a constraint index, and a force. You can build a StructuralConstraint referencing the distance constraint you want to tear, and pass it to the Tear() method.
See the ApplyTearing() method in ObiTearableCloth for an example of using Tear(). ApplyTearing() iterates trough all distance constraints in the cloth, finds the constraints that are over the tear threshold, puts them into a List<StructuralConstraints>, sorts them by force, and then tears the first few of them.
In your case, you'll need to figure out how to get the constraints joining the vertices you want to tear, then generate the list of StructuralConstraints to tear.