As far as I know there is no possibility in changing the distance between the two nodes which the PinJoint2d wants to reach. This would be an interesting feature so you could propose it in the github issues!
I'm not comfortable with Godots codebase, but if I'm not mistaken the resting distance is calculated with the help of the relative vectors
rB which are constructed by
rA = A->get_transform().basis_xform(anchor_A);
rB = B ? B->get_transform().basis_xform(anchor_B) : anchor_B;
(Can be found here)
The problem is that the initial positions of node A (
p_body_a) and node B (
p_body_b) are used to define these vectors when the PinJoint is created (in the constructor):
anchor_A = p_body_a->get_inv_transform().xform(p_pos);
anchor_B = p_body_b ? p_body_b->get_inv_transform().xform(p_pos) : p_pos;
So as long as
anchor_B can't be recalculated there is no way of changing this "resting distance".