Create a bungee rope / grappling hook.

I’m trying to create a 2D rope swinging game and I’m having trouble getting a bungee cord /grappling hook working.

You click a point on the ceiling and my character slings out a rope towards the point you clicked. It then sets an anchor point there, draws a line between the character’s hand and the anchor, and pushes the character in that direction.

The problem is that it doesn’t quite look right, because my ragdoll character isn’t actually pulled by the rope.

I’ve tried using a HingeJoint - but then it won’t pull the character in, it only swings.
I’ve tried using a spring but that didn’t work either.

Anyone have any ideas on how to code this successfully? I’d appreciate it.

Edit: For anyone wondering, I accomplished this by setting a target point, attaching a spring joint to the body of my character and to the target point, then allowing the joint to exist for a few seconds (which exerts a pulling force on the character), then deleting the joint. Happy coding :slight_smile:

It can be done with joints