Rope/distance joint stretches (and "breaks") when I apply load

Here's the place to get help and discuss features. The focus is on the C++ version, but generic questions are welcome.
HughPH
Posts: 8
Joined: Thu Jul 20, 2017 7:19 am

Rope/distance joint stretches (and "breaks") when I apply load

Postby HughPH » Wed Aug 02, 2017 5:00 am

So I have a climbable rope for my game, comprised of a bunch of tall & narrow fixtures/bodies.

I prototyped in R.U.B.E. and this demonstrates the issue quite nicely.

Whether I attach the player or not, I can apply (what appears to be a great deal of) force to my rope (fixtures) and one or two of the joints will "break" and be unable to return back to their original position until I pull the bodies back together "manually."

When in my own code my player wants to climb the rope, I add a distancejoint between him and the topmost fixture that's behind him. As he climbs, I check if his waist is above the top of the distancejoint.If it is, I destroy it and create a new joint. This works beautifully, EXCEPT THAT I'm getting the same behaviour as in RUBE: my "rope" (chain of bodies) stretches.

I have tried setting my player's main body fixture's density to zero, and separately I have set his whole GravityScale to 0, but the same always happens. He's not that heavy!

already broken in r.u.b.e.
https://s3-eu-west-1.amazonaws.com/lode ... njoint.PNG

while breaking in my code...
https://s3-eu-west-1.amazonaws.com/lode ... joint2.PNG
Last edited by HughPH on Wed Aug 02, 2017 7:04 am, edited 2 times in total.

HughPH
Posts: 8
Joined: Thu Jul 20, 2017 7:19 am

Re: Rope/distance joint stretches when I apply load

Postby HughPH » Wed Aug 02, 2017 5:46 am

If I set Frequency and Damping to 1000, it sort-of works, but I'm still not entirely happy with it.

https://youtu.be/T7JkYnJ-Gts

HughPH
Posts: 8
Joined: Thu Jul 20, 2017 7:19 am

Re: Rope/distance joint stretches (and "breaks") when I apply load

Postby HughPH » Sat Aug 05, 2017 5:04 pm

I'm starting to think I should find another way to do ropes. The rope should be taught above the player, so I could just attach him to the ceiling - but then it won't be realistic if there are any interactions inbetween the ceiling and the player. Another option might be to simply break the rope, put the player at the break and dangle the remaining rope from the player, and coerce the top half of the rope into the right position with the player simply placed at the same point.

Any suggestions welcome.

HughPH
Posts: 8
Joined: Thu Jul 20, 2017 7:19 am

Re: Rope/distance joint stretches (and "breaks") when I apply load

Postby HughPH » Fri Aug 11, 2017 3:38 pm

So what I've done is register ropes as objects in my own code. All they have is a collection of fixtures.

When the player is over some rope fixures, he can start climbing the rope. When that happens, a DistanceJoint is added between the player and the top of the rope (first item in the rope's collection). When he wants to climb up, the DistanceJoint is shortened. For each iteration of the game logic, rope fixtures on the climbed rope that have a Y position within the range of the player's body have forces applied to them to move them towards the centre of the body. This gives the illusion of the player climbing the rope.

To render, a Catmull-Rom point is generated inbetween all the points and a sprite rotated and rendered under each node (inbetween the nodes.) The angle is the arc tangent, and the texture length is the hypotenuse of a triangle formed by the X & Y differences between the nodes.

The top of the rope is a separate Static body, the rope is not attached to the scenery.

https://youtu.be/6CMfpfN1jVc


Return to “General Discussion”



Who is online

Users browsing this forum: Bing [Bot] and 1 guest