Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a physics-based rope smoothly reel in two parts?

Asked by 4 years ago
Edited 4 years ago

I'm making a game where one of the main features is a grappling hook similar to the one from the Just Cause franchise. The player is able to tether two parts together depending on where they aim with a rope constraint.

When a tether is created between two parts, I want the rope to reel in and pull the parts together until the rope reaches a certain length.

My question is what method is best suited for reeling in a rope?

I can't just gradually shorten the rope length because physics aren't applied to the parts when it reels in, and the parts will just teleport to the maximum rope length. That's not very effective if the rope is covering a long distance or it's reeling quickly because it will look choppy.

I could apply a vector force that draws the attachments towards each other and then make the rope length equal to the distance between the attachments whenever the attachments get closer to one another, but that would lead to an inconsistent speed with the rope reeling when there are external forces applied on the individual parts.

Currently I'm connecting a spring constraint with a high stiffness and free length of 0 to either attachment and deleting it when the attachments are within 3 studs of one another while constantly changing the rope length to the current distance, but that leads to the same problems with the vector force solution.

Does anybody have a method that more accurately reflects real life physics? Thanks for the help.

0
There is no such thing as a "best" way. This question is primarily opinion based. Make sure your questions can be *answered*, not *discussed*. programmerHere 371 — 4y
0
Woah dude slow down. I obviously have a measurable goal. I'm trying to make the physics that occur from reeling in the rope as close to real life as possible, so there obviously is a best way. You or anyone else can answer my question by suggesting a method that is more accurate than what I've come up with so I can test it to see if it is close to real life physics. aquathorn321 858 — 4y
0
Either way you have started a discussion which the site isn't for. Know what the Q in Q&A means? programmerHere 371 — 4y
0
The question is how can I make a rope constraint reel in a part according to real world physics so I can go about coding it. My question is answerable and relevant. aquathorn321 858 — 4y

Answer this question