Obi Official Forum
Help Break Pin Constraint Event - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html)
+--- Thread: Help Break Pin Constraint Event (/thread-1606.html)



Break Pin Constraint Event - Visitor245262 - 07-01-2020

Is there a way to detect when and which pin constraint is broken when the "Break Resistance" property is set?


RE: Break Pin Constraint Event - josemendez - 07-01-2020

(07-01-2020, 01:48 AM)Visitor245262 Wrote: Is there a way to detect when and which pin constraint is broken when the "Break Resistance" property is set?

Not by default, but it's pretty easy to add a callback fro this.

In ObiParticleAttachment.cs, line 371, the BreakConstraints() function is called for each pin constraint batch. This function iterates over all constraints in the batch, checking which ones should break, and breaking them. Slighty modify this function so that it calls a C# event or a Unity event you can subscribe to, for each constraint it breaks.

Let me know if you need help with this.


RE: Break Pin Constraint Event - Visitor245262 - 25-04-2020

(07-01-2020, 08:00 AM)josemendez Wrote: Not by default, but it's pretty easy to add a callback fro this.

In ObiParticleAttachment.cs, line 371, the BreakConstraints() function is called for each pin constraint batch. This function iterates over all constraints in the batch, checking which ones should break, and breaking them. Slighty modify this function so that it calls a C# event or a Unity event you can subscribe to, for each constraint it breaks.

Let me know if you need help with this.

Thank you, I was able to get this working. Additionally, is there a way to get the current solver that is being used inside BreakConstraints() as the constraint gets broken? Im using version 3.4 Thanks.