Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic Pin Constraints?
#1
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
Reply
#2
(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/tutor...aints.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.
Reply
#3
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]
Reply
#4
(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...php?tid=82. I can add constraints no problem but they won’t remove as of yet. Going to work on it later.
Reply
#5
(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?
Reply