Obi Official Forum
Dynamic Pin Constraints? - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Dynamic Pin Constraints? (/thread-72.html)



Dynamic Pin Constraints? - gxiv. - 14-08-2017

Hi!

What is the method for dynamically adding pin constraints to a rope??

I've tried creating an ObiPinConstraintBatch object, using the AddConstraint function, and then using AddBatch to add the pinconstraintbatch to the ropes pin constraints. I reference the pin constraints of my rope with:
pinConstraints = swingRope.GetComponent<ObiPinConstraints> ();

Is this the proper way of doing this? Because what I've written appears to have no affect! I would appreciate any help!!

gxiv


RE: Dynamic Pin Constraints? - josemendez - 15-08-2017

(14-08-2017, 02:04 AM)gxiv. Wrote: Hi!

What is the method for dynamically adding pin constraints to a rope??

I've tried creating an ObiPinConstraintBatch object, using the AddConstraint function, and then using AddBatch to add the pinconstraintbatch to the ropes pin constraints. I reference the pin constraints of my rope with:
pinConstraints = swingRope.GetComponent<ObiPinConstraints> ();

Is this the proper way of doing this? Because what I've written appears to have no affect! I would appreciate any help!!

gxiv

Hi,

Check out the manual page on how to add/remove constraints:
http://obi.virtualmethodstudio.com/tutorials/scriptingconstraints.html

You should not create a new batch, as there's already an empty one by default on all actors. You just:
- Remove the constraints from the solver.
- Get a reference to the first pin constraint batch.
- Add/remove constraints from the batch.
- Add back the constraints.


RE: Dynamic Pin Constraints? - gxiv. - 17-08-2017

I've followed the tutorial (will post code bellow)
In some instances of testing it appears to not work, and in others it looks as though it might but then Unity crashes.

Here's my code:
[Image: 478eeaa19e.png]


RE: Dynamic Pin Constraints? - niZmo - 31-08-2017

(17-08-2017, 12:57 AM)gxiv. Wrote: I've followed the tutorial (will post code bellow)
In some instances of testing it appears to not work, and in others it looks as though it might but then Unity crashes.

Here's my code:
[Image: 478eeaa19e.png]

Hey I just posted somthing similar to what you want here http://obi.virtualmethodstudio.com/forum/showthread.php?tid=82. I can add constraints no problem but they won’t remove as of yet. Going to work on it later.


RE: Dynamic Pin Constraints? - niZmo - 31-08-2017

(17-08-2017, 12:57 AM)gxiv. Wrote: I've followed the tutorial (will post code bellow)
In some instances of testing it appears to not work, and in others it looks as though it might but then Unity crashes.

Here's my code:
[Image: 478eeaa19e.png]

Are you telling the pin constraint to PushDataToSolver() at the end?