Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Break Pin Constraint Event
#1
Is there a way to detect when and which pin constraint is broken when the "Break Resistance" property is set?
Reply
#2
(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.
Reply
#3
(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.
Reply