Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope lenght on demand
#1
Hi,

Bought this tool recently for a single straightforward task - I want my rope to extend on demand (i.e. when you shoot a harpoon, I want the rope to follow the tip until the rope's maximum lenght is reached).
Right now I've played quite a lot with Obi Rope but the ChangeLenght method just can't keep up with my "tip" object. Whenever I shoot the object it feels like the rope just drasticly stops my gameobject. Doesn't matter how often I call the change length method.


So my question - is there any way to achieve the "extend on demand" effect with Obi Rope?
Reply
#2
(09-05-2018, 05:40 PM)Jimess Wrote: Hi,

Bought this tool recently for a single straightforward task - I want my rope to extend on demand (i.e. when you shoot a harpoon, I want the rope to follow the tip until the rope's maximum lenght is reached).
Right now I've played quite a lot with Obi Rope but the ChangeLenght method just can't keep up with my "tip" object. Whenever I shoot the object it feels like the rope just drasticly stops my gameobject. Doesn't matter how often I call the change length method.


So my question - is there any way to achieve the "extend on demand" effect with Obi Rope?

Hi,

As long as you call ChangeLength at the appropriate time, it should work fine.

I'm assuming the harpoon is a rigidbody, as such, it moves dusting FixedUpdate(). This means you need to predict how much the harpoon is going to move during this frame (use its velocity) and then call ChangeLength() so the rope is long enough to be completely extended at the end of that frame, when the simulation has finished (the harpoon has moved).

If you extend the rope when FixedUpdate has finished, the rope and the harpoon have already been simulated and the rope has of course stopped the harpoon because it was too short.

Also, make sure the mass of your harpoon is high enough (in relation to the rope's) so that the rope will not drastically affect its velocity.
Reply
#3
(10-05-2018, 08:22 AM)josemendez Wrote: Hi,

As long as you call ChangeLength at the appropriate time, it should work fine.

I'm assuming the harpoon is a rigidbody, as such, it moves dusting FixedUpdate(). This means you need to predict how much the harpoon is going to move during this frame (use its velocity) and then call ChangeLength() so the rope is long enough to be completely extended at the end of that frame, when the simulation has finished (the harpoon has moved).

If you extend the rope when FixedUpdate has finished, the rope and the harpoon have already been simulated and the rope has of course stopped the harpoon because it was too short.

Also, make sure the mass of your harpoon is high enough (in relation to the rope's) so that the rope will not drastically affect its velocity.

You are correct, that's exactly what I did. A rigidbody; got it's velocity magnitude; changeLenght(rbMagnitude) on fixed update. However, one factor I did not include was the mass.

Will play around with it. Hope it works.

Thanks for the quick reply Sonrisa
Reply