Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Cutting Cloth
#1
Pregunta 
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 !
Reply
#2
(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.
Reply
#3
(18-12-2020, 09:09 AM)josemendez Wrote: 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.


Thank you very much, I'll try this right away !
Reply
#4
Hi ! So I've been trying out what I was told, about generating the list of StructuralConstraints to tear, and I got around a way to select the constraint I actually needed to tear. The method I've used is mostly inspired by the ApplyTearing() one, but I still have a few questions.

First of all, when I generate my StructuralConstraints, I don't input any force to them (just set it to a default 0), and I wonder if it can lead to error afterwards.

Then, when I tried to use the Tear() method, I was stuck with the first condition, where we can't split if there aren't any free particles in the pool. Therefore, I disabled the first particle of each pair corresponding to a StructuralConstraint

Now, I'm facing a problem where I can't seem to complete some of the SplitTopologyAtVertex() operations. The otherSide.Count is sometimes equals to 0, returning false and keeping me from completing my cut.

I'm stuck here, I can't find any way to proceed further, some help here would be very appreciated.
(If needed I can supply photos, I know my explanations are a bit messy).
Thanks !
Reply