I have objects in a chain such that they all lie on the same line, and the distance between each pair of objects is equal.
The end points of the chain are user controllable, so that when they are grabbed and moved, the chain stretches and rotates to fit the above criteria.
Right now I am setting velocities to move all the objects with an offset to match the offset between the mouse and the grabbed end, and a frame later (right after the simulation step) I reset the velocities to 0. However, this fails when any object collides with something, since the chain still moves as a whole, but that object gets stuck (and thus the distances between it and the two adjacent objects isn't kept as the rest).
I want the chain to stop stretching once any of the objects get stuck.
I can't think of any way to keep these conditions, and also react to collisions properly.
Is there any sane way to do this with Box2D?
Thanks.
The end points of the chain are user controllable, so that when they are grabbed and moved, the chain stretches and rotates to fit the above criteria.
Right now I am setting velocities to move all the objects with an offset to match the offset between the mouse and the grabbed end, and a frame later (right after the simulation step) I reset the velocities to 0. However, this fails when any object collides with something, since the chain still moves as a whole, but that object gets stuck (and thus the distances between it and the two adjacent objects isn't kept as the rest).
I want the chain to stop stretching once any of the objects get stuck.
I can't think of any way to keep these conditions, and also react to collisions properly.
Is there any sane way to do this with Box2D?
Thanks.