Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Pin Constraints break at runtime when pinned object is enabled/disabled
#1
I have a rope that is set up with Pin Constraints to a Unity Rigidbody + ObiRigidbody + ObiCollider.

That works as intended, the rope pulls the Unity body and vice versa.
However, as soon as I disable the pinned object and enable it again, the Pin Constraint stops working - the rope is still attached to the object, but the object does not move according to physics anymore (behaves as if it would be kinematic). Both isKinematic (on the rigidbody) and kinematicForParticles is turned off, obviously.

Am I missing something? Is there a call to "wake up" the Pin Constraint?

EDIT: it seems enabling/disabling alone doesn't cause the bug, still trying to investigate. It does happen every single time in my case, so the question on how to recover a broken Pin Constraint at runtime still holds.

EDIT 2: the bug is caused by parenting the Unity object to another object in a different scene, then parenting it back into the original scene. Note that "regular" scripts just keep their referenced object even if it is in another scene.
Reply