/// <summary> /// Connects the gameobject to the starting end endingJoint /// </summary> public void ConnectToJoints() { if (startingBone == null || endingBone == null) { return; } startingBone.Connect(this); endingBone.Connect(this); // connect the musclejoints with a spring joint if (startingBone.BoneData.legacy) { spring = startingBone.legacyWeightObj.gameObject.AddComponent <SpringJoint>(); } else { spring = startingBone.gameObject.AddComponent <SpringJoint>(); } spring.spring = SPRING_STRENGTH; spring.damper = 50; spring.minDistance = 0; spring.maxDistance = 0; spring.anchor = startingBone.Center; spring.connectedAnchor = endingBone.Center; if (endingBone.BoneData.legacy) { spring.connectedBody = endingBone.legacyWeightObj.GetComponent <Rigidbody>(); } else { spring.connectedBody = endingBone.GetComponent <Rigidbody>(); } spring.enablePreprocessing = true; spring.enableCollision = false; }