This project has moved and is read-only. For the latest updates, please go here.

Create rope like this game

Nov 3, 2011 at 4:28 PM
Edited Nov 3, 2011 at 4:29 PM
im trying to make a rope script like this for about 2 weeks.
I need my rope able to collide bodies like the game does.
I tried rope joints , and it works fine when I only have 1 joint,
but there is no collision of course,
and if I create many bodies with rope joint,
when I update length,
it didnt works fine, the joints will jumping around.
so how can I make a rope like the game?

Nov 3, 2011 at 10:01 PM

Well to achieve that type of rope is quite easy. Because it doesn't behave like a real physical rope i.e - it doesn't ever have any visible slack. To make a real rope using a physics engine you will either need to use many small segments (worse performance and stability, but simpler to implement) or a custom colliding rope joint.

The image helps define what I'm talking about. I'm not sure on how I would go about implementing all the details but by using the rope joint from Farseer you should be able to enable really stable colliding ropes, even with large mass differences.

I hope this makes sense. All the collision detection for the rope will have to be done by you. I won't go into just how to accomplish this but it shouldn't be to hard.

Nov 4, 2011 at 6:11 PM


I tried raycast detecting and it failed

can someone make a simple code to help me?

Nov 4, 2011 at 6:57 PM

I don't have time to write any code for you but I would...

Take the bounding box of the current dynamic part of the rope.

Test all fixtures contained in the bounding box against a line segment checking to see if any fixture is penetrating the line segment.

If a fixture is penetrating then you have a collision point!


It's a little more complicated then that but hopefully that should get you going in the write direction.

Nov 21, 2012 at 4:23 PM

sorry for crashing over and old post but Am having the same problem i had to create rope using pathgenerator but am not happy with the result i would prefer a rope just like in the game, any luck achieving that??