09-06-2020, 10:32 AM
(This post was last modified: 09-06-2020, 10:39 AM by josemendez.)
(09-06-2020, 09:31 AM)Andrew Graham Wrote: I would also be interested in this. I am trying to implement a knife that will instantly cut the cloth whenever it comes into contact with it. It there a way to do this with Obi Cloth?
Thanks.
Hi Andrew,
Sure, there's three steps involved:
- Detect contacts between the knife and the cloth particles. See:
http://obi.virtualmethodstudio.com/tutor...sions.html
- Get the contact particle index, and find out which constraint (s) involve that particle by iterating over all constraint batches.
- Call cloth.Tear() passing a StructuralConstraint struct, that references the constraint and its batch.
You can see an example of the last two steps in ObiTearableCloth's ApplyTearing method: It iterates over all constraint batches, finds the ones whose force exceeds a threshold (you would find the ones in contact with the knife instead), then calls Tear() for them.
Here's an example of this made by a fellow user, found it in reddit recently: