Ropes that attach 2 objects

I’m currently working on developing a ragdoll game, and I’ve been trying to figure out how to implement ropes that can connect two objects with attachments. This feature is proving to be a bit challenging for me. I’d appreciate some guidance on how to create a system where players can connect and disconnect objects using ropes in the game

1 Like

I believe there is an example, here it is:

1 Like

Thanks @Hong_Jooni_Pooni

Also btw this string does not pull the two dots toward eachother. That is more complicated. This is a visual effect.

If you want the two dots to pull to eachother, then use the example, for the visuals, and try and implement a spring for the physics… I was actually trying to implement springs a while ago, here are my notes:



A,B - two mass points

Ks - stiffness

Lo - rest length

Kd - damping factor


Force produced by the spring = Fs

Fs = Ks * x

X = distance between the two points - Lo

Move closer,

Fs > 0

Move father,

Fs < 0

Fd = (b-a)/(Math.abs(b-a))*(vB-vA)*Kd

Ft; Final force with air resistance = Fd + Fs

Full equation:

Ft = (Dist - Lo) * Ks * (Dist)/(ABS(Dist)) * (vB-vA) * Kd

Now convert to 2d movement for each mass point

Fa (point A) = Ft*(Dist B-A/ABS B-A)

Fb (point B) = Ft*(Dist A-B/ABS A-B)

Positive force = move towards each other

Negative force = move away from each other

1 Like