Maximum distance joint

By the way, i found an interesting and useful bug with prismatic joint - if axis is [0;0], bodies can move freely but keep their angle equal
Woah, nice!
That's pretty clever.
Hm i found prismatic better, you dont have to set anchor point (with revolute its important for better stability
Pangamini wrote:
Is there something like max. distance joint? Or maybe with min. value too. the joint would behave just like distance joint, if 2 points got beyond this maximum distance, otherwise there would be free movement.
I found it pretty easy to change the existing b2DistanceJoint to do this, just by skipping the correction code if the distance was already long/short enough. However Erin suggests the pulley as a base for refactoring, making me think perhaps I am overlooking something and it's not as simple as it seems...
Anyway I'll attach it here in case someone else finds it useful.
Attachment:
b2DistanceJoint.rar [3.48 KiB]
Downloaded 76 times
Use like:
Code:
b2DistanceJointDef jointDef;
jointDef.enforceMin = false;
Yeah it works... until anchors are in the center of mass...
do you mean, until anchors are not in the center of mass? Anchors in the center of mass was the only thing I tried it with...
Sure i mean "not in the center", sorry
ok, now I have actually started to need this myself. It looks like the code change I did is not much good for a real situation. It works ok with a chain just hanging in space like in the testbed, where the anchors are all in the center of mass of their bodies, but anything other than that and it falls apart in fine style.

So now I'm trying the revolute+prismatic approach as suggested. And.... correct me if I'm wrong but getting the behaviour of a maximum distance joint would require two revolutes and a prismatic right? (as opposed to the one revolute and one prismatic mentioned in this thread)
Yeah, of course. Should have seen that 😳

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