Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pin Constraints Vanishing
#1
Hi all,

I've just updated to 3.2 and have tried to add Pin Constraints to my Rope, this works as expected, however when I hit play one of the pin constraints just gets lost, it loses the object reference and all the parameters (offset, break resistance) become 0. There are other particles pinned to the same object that work fine, so I'm not sure what the problem is here.
I can get it working fine with Handles but that obviously doesn't give the same desired behaviour as the pin constraints do. The objects being pinned to contain a Sphere Collider, Rigidbody, Obi Collider, and Obi Rigidbody. They are on the same layer as the rope.

Any ideas?

Cheers,

Josh
Reply
#2
I'm having exactly the same problem; adding Pin Constraints seems to work as expected until I hit play, and then some (but not all) of them lose their object reference. So that when I leave play mode, the Pin Constraint is still there in the editor, but 'Pinned to:' has been reset to 'None (Obi Collider)'. It's extremely frustrating; there seems to be nothing different about the Pin Constraints that work and the ones that don't. This is a big problem, and its been three weeks since the original post. Help!

pH
Reply
#3
I think I've found a workaround – haven't tested it thoroughly yet, but so far it seems to work: Pin Constraints work as long as the ObiRope is not an instance of a prefab. No idea why this would be, but if I select 'GameObject/Break Prefab Instance' before setting up my Pin Constraints, everything behaves the way it should. 

Josh, I'd be curious whether this works for you; since I have no idea whether your ObiRopes were prefabs, I don't know if this will help you. 

In any case, this seems to be a bug & it should get fixed.
Reply
#4
(09-12-2017, 02:00 AM)phoberman Wrote: I think I've found a workaround – haven't tested it thoroughly yet, but so far it seems to work: Pin Constraints work as long as the ObiRope is not an instance of a prefab. No idea why this would be, but if I select 'GameObject/Break Prefab Instance' before setting up my Pin Constraints, everything behaves the way it should. 

Josh, I'd be curious whether this works for you; since I have no idea whether your ObiRopes were prefabs, I don't know if this will help you. 

In any case, this seems to be a bug & it should get fixed.

If the rope and the object being referenced (the collider in the pin constraint) are not part of the same prefab, the rope will lose all references to that object upon instantiation. This is just how prefabs work in Unity. If you want a prefab to maintain a reference to an object that is not contained in the prefab, you must either:

- Include the referenced object in the prefab.
- Re-set the reference after instantiation yourself.

Anyway, I've tried to reproduce the issue you and PhantomBadger describe (when working with a regular rope, not a prefab) to no avail. If you could provide the steps you followed to reproduce it it would be of great help!
Reply
#5
Thanks Jose. 

It seems pretty clear that the problem I was having was because I wasn't aware of this limitation of prefabs. So I don't think there's any issue/bug.

In my case, it isn't practical to include the referenced object in the prefab, since I have a lot of (similar) ropes with pin constraints to lots of (different) objects, so the best solution is simply to break the prefab instance, and everything works as expected.
Reply