i want to create a long rope with revolute & small rectangle

i know the idea that to create many small rectangles jointed with revolute joints plus the rope joint to simulate a rope , just as in the TestBed example.

i want to create a longer rope attatech on two static body at each end.
what i coufused is that the rope is longer than the distance of the two objects.
if i know the needed rope length && the two static boxs's position .
how can i calculate how many small rectangle i need to create and jointed one after another.
and how to places these small rectangles's initial position ?

any one advice ?
How about just making more bodies than needed to cover the distance, and space them closer together?
For example if the distance is 10 units, and you want the chain bodies to be 1 unit long, then 10 bodies spaced at 1 unit intervals is enough to cover the distance.
But if you make 20 bodies (still 1 unit long, with joint positions the same) and space them at 0.5 unit intervals will give you a longer chain.
irresistible force wrote:
How about just making more bodies than needed to cover the distance, and space them closer together?
For example if the distance is 10 units, and you want the chain bodies to be 1 unit long, then 10 bodies spaced at 1 unit intervals is enough to cover the distance.
But if you make 20 bodies (still 1 unit long, with joint positions the same) and space them at 0.5 unit intervals will give you a longer chain.


i have a idea , initially position all small rectangles in straight line just between the two static body. spacing them equally ,and using distance joint. even if i put them overlap each other , they can still can finally got to the right position soon. because i can set the distance joint's length to zero.

Original thread: https://box2d.org/forum/viewtopic.php?t=9256