PinJoint2D why do the joints stretch - bug or am I doing it wrong?

Godot Version

4.2.1

Question

I’m attempting to make a simple rope/chain for my player character that will be fired at objects so they can be carried away.

To prototype this I setup a single chain link which is pretty small 6x8 pixels (as it’s supposed to look pretty thin and the main sprite it’s going to dangle from isn’t large)

I make a rigidbody2d scene to add the rope sprite and collider and then put 10 of these end to end and use pinjoint2d’s to join them together (adding a staticbody2d at the top so the rest will hang off of it)

While this has the desired effect in terms of the bodies reacting rather like a rope, I notice that the joints separate when they are moved quickly. I’ve got simple code that just moves the origin of the staticbody2d to the mouse pointer and the rope can literally double in size when this moves over a large distance fast.

I thought the point of the softness property was to define how stretchy you want the joints - where 0 is “not stretchy at all”. It does feel like a bug to me, unless Ive either misunderstood of mis-implemented the ides?

I’m kinda a Godot rookie, so you may have already tried this, but I noticed there’s also a bias setting that sounds similar to what you’re describing?

Maybe increasing that could help?

1 Like

Cheers - I did try the high bias. I do find that setting to the max of 0.9 can make the whole rope goa bit crazy for a while, but the joints still separate out a lot

1 Like

Few more bits of info to demonstrate things. Here’s a pic of how my bodies are pinjoined together

…and here’s a quick video showing the rope in action. I set it up to be pretty thin as mentioned, so it can be a little difficult to see. So in the 2nd part of the video I use line2d to draw between each of the bodies which are supposed to be joined - so it’s clear to see how much they are stretching

Currently having the same problem but in 3D joints, after switching to the Jolt physics engine (which I understand could become default in the future), there’s a setting that seems to reduce that elasticity effect:

In Project Settings > Physics > Jolt 3D there’s a “Position correction” setting that seems to, not cancel, but at least reduce its effect if put to the max, at 100% (key: physics/jolt_3d/solver/position_correction).

Note: So far I haven’t seen a setting on the joint node or node tree configuration that seems to correct that elasticity other than in the settings

Cheers - I saw jolt earlier and thought it would help, but it’s 3D only, so no help on my 2D issue. I was able to minimise the stretch by reducing the weight at each stage - it’s a bit of a faff to do, but I have a ridigbody object that weights 50kg, so I attach the first link of the rope to it and that rope weighs 20kg, then the next link is 10, 5, 2.5… and I keep halving it as I go. This way, the sum of everything below the link always weights slightly less that the thing it’s all attached to.

While this did a better job at minimising the stretch, it’s not good enough for me, I can still catch part of my rope on scenery and then it goes crazy.

My current task is to use CharacterBody2D links and do the physics myself - which sounds awful, since I’m a bit clueless in terms of physics, but I can learn