How to get Joint connectedBody OnJointBreak

I have multiple joints connected to a group of objects. If a joint breaks I want the original object and the connected object to respond. The method OnJointBreak doesn’t give me any indication of the Joint connectedBody. How can I find the body that was connected?

Why the heck would they only give break Force!? Please help.

I created a work around that is not what i want, but until someone can suggest something better this is what i did.

created an array of connections

//joints
public ArrayList<Part> connections;

then as i create joints i add them to both parts, the original and the connectedBody.

parts[i, j].connections.Add(parts[i + 1, j]);
parts[i + 1, j].connections.Add(parts[i, j]);

then when a joint breaks i flip a flag and wait:

void OnJointBreak(float breakForce) {
	JointBroken = true;
}

in the next update (when the joint has been destroyed) I the go looking for the missing joint:

if (JointBroken) {
	Ship.EvaluateJointBreak(this);
	JointBroken = false;
}

then i can find and act on missing joint

	public static void EvaluateJointBreak(Part part) {
		foreach (Part sp in part.connections) {
			if (sp == null) 
				continue;
			Joint j = findJoint(part,sp);
			if (j == null) {
				//missing joint
			}
		}
	}	

	public static Joint findJoint(Part part1, Part part2) {
		foreach (Joint j in part1.GetComponents<Joint>()) {
			Part temp = j.connectedBody.GetComponent<Part>();
			if (temp == part2) {
				return j;
			}
		}
		foreach (Joint j in part2.GetComponents<Joint>()) {
			Part temp = j.connectedBody.GetComponent<Part>();
			if (temp == part1) {
				return j;
			}
		}
		
		return null;
	}

There you go.

I recently ran into this issue, but found a better solution, likely because of Unity updates.
In Unity 2018 you can now check joint.currentForce.
Not sure when that was added

private void OnJointBreak(float breakForce) {
		for ( int i = 0; i < joints.Count; i++ ) {//have list of joints
			ConfigurableJoint joint = joints*;*
  •  	if (breakForce != joint.currentForce.magnitude ) {*
    
  •  		continue;*
    
  •  	}*
    
  •  	RemoveJoint(joint); //do joint cleanup*
    
  •  	break;*
    
  •  }*
    
  • }*