I have a rope and at both ends there is a pin constraint to two different objects. After a 'event' i would like one of the pin constraints to be attached to a new object. How do i do this? i tried copying the code from the Grappling hook scene by doing this:
https://gyazo.com/df0ab0ef81ea4b37b709bb44f62ba535
Thanks in advance for any help!
(09-04-2018, 12:53 PM)Karlanton Wrote: [ -> ]I have a rope and at both ends there is a pin constraint to two different objects. After a 'event' i would like one of the pin constraints to be attached to a new object. How do i do this? i tried copying the code from the Grappling hook scene by doing this:
https://gyazo.com/df0ab0ef81ea4b37b709bb44f62ba535
Thanks in advance for any help!
Hi there,
You can remove the old constraint, then add a new one that uses the new object just like you are doing. However you must pass the index of a constraint to RemoveConstraint(), not the index of a particle. (i.e. If you only have one pin constraint added, you should pass "0" as the index).
(10-04-2018, 10:13 AM)josemendez Wrote: [ -> ]Hi there,
You can remove the old constraint, then add a new one that uses the new object just like you are doing. However you must pass the index of a constraint to RemoveConstraint(), not the index of a particle. (i.e. If you only have one pin constraint added, you should pass "0" as the index).
https://gyazo.com/e25e93e5929bdff59c0c5ba40936fc40
Did this now. The pin constraint does get removed but the rope is still attached to the first object that had the pin constraint from the beginning and no new pin constraints were added to the last particle. I was not sure what to pass in the rope.addsolver(?) so i tried both with null and the pinconstraint. Where am i doing it wrong haha?