RopeJoint Collision

Nov 20, 2012 at 5:05 PM

is there anyway to make the rope in the rope joint and the pulley joint to collide with objects in space??

Coordinator
Nov 20, 2012 at 7:27 PM

Take a look at the CollideConnected property on the joints.

Nov 20, 2012 at 7:43 PM

collideConnected make the body inside the joints collide with each other, this is not what i want, what i want is that the rope it self (the joint) to collide with world objects, ive researched, i think i have to create my own rope to be able to collide with everything.

Coordinator
Nov 22, 2012 at 12:30 AM

After reading your other post, I think I understand what you want.

First off, you need to understand that here are no 'rope' in the rope joint or pulley joint. It is math that gives constraints between two points, and the 'rope' you see in a game like that flash ninja game from the other thread, is just a line being drawn between the 2 points the constrain works on.

If you need the line between the two points to collide with the world, you need to put a body there. You could create an edge shape between the two points and resize it to be the distance between the two points. The rope itself is a distance joint with a variable length.

Nov 23, 2012 at 3:11 PM

i understand that about the rope joint, how to make it break into two in the case of collision, i mean even if i added an edge it wont behave like a rope.

Nov 24, 2012 at 11:01 AM

I use ropes and chains a lot and it works beautifully. A rope is a deformable body so to simulate it properly we need continuum physics that would support deformations (compression, elongation, bending and twisting). So with Farseer we need a trick - the "rope" doesn't exist but it's made of many small long and thin bodies connected with joints. It's like using a Finite Element method. This way the rope segments get full collision detection and response. I usually use rectangle/capsule polygons to have real mass and occupy space because EdgeShapes are infinitely thin and collisions sometimes cause penetrations. I also overlap my shapes to avoid corners getting stuck (capsules are better in that regard).

The Testbed has examples RopeTest, ChainTest, Cantilever and Bridge that could be useful. Joint and body parameters need tuning but for simple scenarios the results are really great. I've gone as far as simulating "rope" rolling and unrolling on a rod and it's quite realistic.