Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Fishing Pole/Line
#25
(10-06-2022, 12:03 AM)Natty Wrote:
Code:
fishingPoleInHandCursor.ChangeLength(ropeRestLength);
I'm calling this in Update().  What I noticed is that this causes the rope to violently retract spinning erratically around in circles until it's back to its original length.  Is there a way to simply have this reset without needing it to even display that it's shortening?  Or is there a way to do it slower so that it doesn't wildly lose control?  Possibly my code is just wrong.

Hi Natty!

Your code is fine, it's just that changing the length of the rope to its rest length all of a sudden will of course cause it to spring back will quite some force.

Imagine if you had a box hanging from the ceiling by a 4 meter rope. Then the rope gets its length magically and instantly changed to 2 meters while still being attached to both the ceiling and the box: assuming an unbreakable rope, the rope would pull the box up at top speed (or the ceiling down, depending on build quality). Then inertia would cause the rope to swing around for a while.

A quick and dirty workaround would be to temporally set the solver's damping value to a very high value like 0.98, change the length, then set the damping back to whatever it was after a second or so. Damping causes energy to "evaporate", so the rope would go back to its original length slowly.

An proper solution would involve moving whatever objects the rope is attached to a distance equal to or smaller than the rope's length, change rope length,
and then (depending on where your cursor is located along the rope) move all its particles to a position that minimizes energy.

kind regards,
Reply


Messages In This Thread
Fishing Pole/Line - by Natty - 15-04-2022, 12:57 AM
RE: Fishing Pole/Line - by josemendez - 15-04-2022, 09:17 AM
RE: Fishing Pole/Line - by Natty - 17-04-2022, 06:22 PM
RE: Fishing Pole/Line - by josemendez - 18-04-2022, 09:38 AM
RE: Fishing Pole/Line - by Natty - 19-04-2022, 02:56 PM
RE: Fishing Pole/Line - by josemendez - 20-04-2022, 08:47 AM
RE: Fishing Pole/Line - by Natty - 21-04-2022, 01:26 AM
RE: Fishing Pole/Line - by Natty - 26-04-2022, 05:44 PM
RE: Fishing Pole/Line - by josemendez - 27-04-2022, 07:56 AM
RE: Fishing Pole/Line - by Natty - 29-04-2022, 07:13 PM
RE: Fishing Pole/Line - by josemendez - 30-04-2022, 09:40 AM
RE: Fishing Pole/Line - by Natty - 30-04-2022, 04:47 PM
RE: Fishing Pole/Line - by josemendez - 30-04-2022, 05:38 PM
RE: Fishing Pole/Line - by Natty - 30-04-2022, 11:07 PM
RE: Fishing Pole/Line - by josemendez - 01-05-2022, 12:24 AM
RE: Fishing Pole/Line - by Natty - 01-05-2022, 03:40 AM
RE: Fishing Pole/Line - by josemendez - 02-05-2022, 08:54 AM
RE: Fishing Pole/Line - by Natty - 03-05-2022, 06:15 PM
RE: Fishing Pole/Line - by Natty - 25-05-2022, 12:39 AM
RE: Fishing Pole/Line - by josemendez - 25-05-2022, 01:23 PM
RE: Fishing Pole/Line - by Natty - 25-05-2022, 05:25 PM
RE: Fishing Pole/Line - by Natty - 04-06-2022, 09:08 PM
RE: Fishing Pole/Line - by josemendez - 06-06-2022, 07:45 AM
RE: Fishing Pole/Line - by Natty - 10-06-2022, 12:03 AM
RE: Fishing Pole/Line - by josemendez - 13-06-2022, 11:49 AM
RE: Fishing Pole/Line - by Natty - 22-06-2022, 03:11 AM
RE: Fishing Pole/Line - by josemendez - 22-06-2022, 08:32 AM
RE: Fishing Pole/Line - by Natty - 23-06-2022, 02:42 AM
RE: Fishing Pole/Line - by Natty - 28-06-2022, 01:15 AM