Make chain
Making a chain is a fairly common task in Box2D scenes, and this action is here to make that
task easier. It allows you to visually create one link in the chain first as a prototype, and
then duplicate it to create more links.
Using this action requires that you first have two bodies to act as the initial definition of
one chain link. We will use the example below, with two diamond shaped bodies connected by
three joints.
These bodies have been connected by one revolute joint, and two distance joints with their frequency
and damping ratio set so that the two bodies will have a rubbery feeling spring-like connection.
Once the desired behavior for this prototype connection has been set up, we can create the rest
of the chain.
The minimum requirement for using the 'Make chain' action is that two bodies are selected. The order
in which the bodies are selected is important. The body that is selected first becomes the first
body of the chain, and the chain will grow in the direction of the second body.
For example, if we select the left body first and then the right body, run the 'Make chain' action
and enter 3 for the number of bodies to add, the chain will grow to the right. The distance between
the original two bodies is used to calculate where to place the new bodies.
Notice that the joints don't get duplicated if we didn't have them selected. This allows us to
specify which of the joints should be duplicated when the chain is extended. As a further
example, if we were to undo the result above, then select say, only the bottom two joints (one revolute
and one distance) and run the 'Make chain' again, we would get this result:
Finally, here is the result we would get if we had selected the right body first, and then the left
body, and selected all three joints. This time the chain grows to the left, with all the joints duplicated.