Configurable Joints are extremely customizable. They expose all joint-related properties of PhysX, so they are capable of creating behaviors similar to all other joint types.
Turns out any attempt to move the hinged object using transform.position will be snapped back to where it started. you can’t disable the hinge, but you can unscrew the far end:
// Save end of hinge, then unscrew it:
Rigidbody RB = transform.hingeJoint.connectedBody;
transform.hingeJoint.connectedBody = null;
// Tricky, since anchor is local. No easy way to move it "world backwards":
//transform.hingeJoint.anchor += Vector3.forward * 0.1f;
// Can now move unconnected hinge:
transform.position -= Vector3.forward*0.2f;
transform.hingeJoint.connectedBody = RB; // screw it back in
In addition to the above, defining the X-drive, y-drive, and z-drive in conjunction with a target position/velocity can be used to move the object to specific distances, creating a “length” to the joint arm. Be sure to set the x/y/z-drive spring, as this is what pushes the object out to the limit.
If it’s 2D game, use Distance Joint 2D. You can write something like:
joint.distance = yourDistance;
or set EnableCollision and Max Distance Only for minimum distance.