public bool JointTo(Transform target) { ComponentJoint componentjoint = target.GetComponent<ComponentJoint>(); if (componentjoint == null || componentjoint.isJointed) return false; if (isJointed) Separate(); targetJoint = componentjoint; isJointed = true; componentjoint.SourceJoint = this; componentjoint.IsJointed = true; return true; }
//从TargetJoint上分离 public void Separate() { if (targetJoint != null) { targetJoint.IsJointed = false; targetJoint.SourceJoint = null; } isJointed = false; targetJoint = null; }