Maximum distance joint, with free rotation?

I'd need a joint similar to the distance joint, but one which only limits how far apart two bodies can get, while still allowing them to rotate relative eachother.

Here are a few ideas I've thought of:

First one is to create/destroy a distance joint when the two bodies get too far apart. It would not limit their relative rotations, but it would be very tricky to know when to remove the joint. I can't just measure the distance between them since its locked by the joint... Catch 22...

Second option would be to use a prismjoint with a limit, but then the objects won't rotate relative eachother...

Third, I could "manually" adjust the velocities (and indirectly positions) of the two objects by hitting them with impulses as soon as they move too far apart. I'm not sure I could do this compensation in an accurate way though.
Would it be enough to simply apply the impulse in the direction of the other body, and scale it depending on the linear velocity away from that other body?

I thought I'd ask first before trying it myself, since these three solutions would be implemented differently (esp the last one) the way I'm hacking it together now. I'll begin testing the last method after I post this, better get input while I'm doing stuff so I can adjust without having to redo the whole thing after doing it all "wrong". 😀

Edit: There's also the option to actually create a new type of Joint I guess, but I don't understand enough about the inner workings of Box2D to attempt that...
If you use the distance joint attached to the body centers, then they can rotate freely about their centers. In general with the distance joint the bodies can rotate freely about the anchor points.

You can modify the distance joint fairly easily to make it behave like a maximum distance limit. Take a look at the prismatic joint and the way it limits distance.
has anyone gotten DistanceJoint to allow for a min/max limit of length?

i looked through prismaticJoint, but didnt understand how the limitation was achieved. (actually i didnt even get what most of the variables are for). any pointers for that?

thanks!

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