public void SetCableJointConnectedBody(Rigidbody newBody)
{
//Save body relative position
Vector3 relativeBodyPos = KAS_Shared.GetLocalPosFrom(newBody.transform, headTransform);
Quaternion relativeBodyRot = KAS_Shared.GetLocalRotFrom(newBody.transform, headTransform);
//Save body and head current position
Vector3 currentPos = headTransform.position;
Quaternion currentRot = headTransform.rotation;
Vector3 currentBodyPos = newBody.transform.position;
Quaternion currentBodyRot = newBody.transform.rotation;
// Move head and body to lock position
KAS_Shared.SetPartLocalPosRotFrom(
headTransform, this.part.transform, headOrgLocalPos, headOrgLocalRot);
KAS_Shared.SetPartLocalPosRotFrom(
newBody.transform, headTransform, relativeBodyPos, relativeBodyRot);
// Connect eva rigidbody
cableJoint.connectedBody = newBody;
// Return body and head to the current position
newBody.transform.position = currentBodyPos;
newBody.transform.rotation = currentBodyRot;
headTransform.position = currentPos;
headTransform.rotation = currentRot;
}