10-05-2018, 03:39 PM
(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