var fixedJoint = gameObject.AddComponent<FixedJoint>();fixedJoint.connectedBody = otherGameObject.rigidbody;