Obi Official Forum

Full Version: Break Pin Constraint Event
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to detect when and which pin constraint is broken when the "Break Resistance" property is set?
(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.
(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.