### distance joint problem

Posted:

**Thu Aug 28, 2014 7:53 pm**Hi guys,

For almost 2 days I'm trying to create a bridge in box2d using b2distanceJoint and some squared bodies.

Basically I create 7 bodies, and each fixture has the shape of a square with 1 unit leg/side. All parameters for the bodies and fixtures are the default ones.

The first and the last bodies are static bodies, and the rest of the bodies are dynamic bodies. Each consecutive body is linked to the previous one through a distanceJoint. Each joint has the (0,0) anchor point value. The length in the distanceJoint between the bodies, is in my case about 2 units.

Until now I have in code the same setting I did in RUBE Editor (were everything seems to be OK), but, now is the funny part, the result is kicking my ass for two days: the distanceJoint length between the dynamic bodies exceed the length I set for the joints.

I can't find a solution as I don't understand the problem (why the distanceJoint length exceeds). All the progress I made in solving this, was by doing monkey tests (changing the settings and values, times and times again, without any logic, but to see the result), and I found that, if I disable the collisions for the dynamic bodies (by setting the category and mask filters to 0) and also I need to increasing the length up to 4 units for my 1 unit square fixtures, the result is the same with the one in RUBE and it's exactly what I wanted. But the big distance between bodies will not creating me a normal bridge but a ice floating bridge .

I suppose I'm not the first or the last person that's hitting his head to the desk, the walls and the laptop's keyboard with this problem.

If there is anyone that can help me, and all the others like me, please send us a reply .

Thanks guys,

Cristi

For almost 2 days I'm trying to create a bridge in box2d using b2distanceJoint and some squared bodies.

Basically I create 7 bodies, and each fixture has the shape of a square with 1 unit leg/side. All parameters for the bodies and fixtures are the default ones.

The first and the last bodies are static bodies, and the rest of the bodies are dynamic bodies. Each consecutive body is linked to the previous one through a distanceJoint. Each joint has the (0,0) anchor point value. The length in the distanceJoint between the bodies, is in my case about 2 units.

Until now I have in code the same setting I did in RUBE Editor (were everything seems to be OK), but, now is the funny part, the result is kicking my ass for two days: the distanceJoint length between the dynamic bodies exceed the length I set for the joints.

I can't find a solution as I don't understand the problem (why the distanceJoint length exceeds). All the progress I made in solving this, was by doing monkey tests (changing the settings and values, times and times again, without any logic, but to see the result), and I found that, if I disable the collisions for the dynamic bodies (by setting the category and mask filters to 0) and also I need to increasing the length up to 4 units for my 1 unit square fixtures, the result is the same with the one in RUBE and it's exactly what I wanted. But the big distance between bodies will not creating me a normal bridge but a ice floating bridge .

I suppose I'm not the first or the last person that's hitting his head to the desk, the walls and the laptop's keyboard with this problem.

If there is anyone that can help me, and all the others like me, please send us a reply .

Thanks guys,

Cristi