private static LuerlockItemConnection NeedleConfiguration(ItemConnector connector, Transform hand, Interactable interactable) { Rigidbody targetRB = hand.GetComponent <Rigidbody>(); Rigidbody needleRB = interactable.Interactors.Needle.Rigidbody; if (targetRB == null || needleRB == null) { throw new System.Exception("Both parties did not have rigidbody"); } LuerlockItemConnection conn = interactable.gameObject.AddComponent <LuerlockItemConnection>(); conn.Connector = connector; conn.connectedRB = needleRB; conn.interactable = interactable; Joint joint = JointConfiguration.AddJoint(targetRB.gameObject, needleRB.mass); joint.connectedBody = needleRB; conn.joint = joint; JointBreakSubscription.Subscribe(hand.gameObject, conn.JointBreak); return(conn); }
public static LuerlockItemConnection AddLuerlockItemConnection(ItemConnector connector, Transform target, Interactable addTo) { return(LuerlockItemConnection.Configuration(connector, target, addTo)); }