Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to guarantee a rope will not go through a collider?
#5
(08-02-2024, 03:14 PM)lela_tabathy Wrote: If I may hijack this thread, I‘m trying something similar where I‘m reducing the ropes length through Cursor, while the end is attached to a fixed point. I need to make sure the rope doesn‘t go through colliders along the way and basically stops the Cursor. Here‘s a sophisticated drawing, the first one shows the intended behaviour when the rope cursor is at the point where the rope shouldn’t shorten any further.

Any tips?
I‘m currently doing this by checking the rest length and not allowing further shortening that way. But that way I have to trial & error the min length and it‘s not very scalable.

You could compare the rope's rest length to its current length, to see if the rope is overly stretched. If it is, stop the cursor (or even reel out a bit of rope length to reduce strain).

Code:
float strain = rope.CalculateLength() / rope.restLength; // this will be >1 when stretched, <1 when compressed, 1 when under no forces.

let me know if you need further help,

cheers
Reply


Messages In This Thread
RE: How to guarantee a rope will not go through a collider? - by josemendez - 09-02-2024, 08:32 AM