Create rope like this game

Nov 3, 2011 at 3:28 PM
Edited Nov 3, 2011 at 3:29 PM
Hello,
im trying to make a rope script like this for about 2 weeks.
http://www.miniclip.com/games/final-ninja/en/
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?



Developer
Nov 3, 2011 at 9: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 5:11 PM

thanks!


I tried raycast detecting and it failed

can someone make a simple code to help me?

Developer
Nov 4, 2011 at 5: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 3: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??