/// <summary> /// Removes an existing joint from the body. /// </summary> /// <param name="joint"></param> public void RemoveJoint(JointInfo joint) { if (joint == null) throw new ArgumentNullException("joint"); if (joint.ParentBody != this) return; this.joints.Remove(joint); this.AwakeBody(); if (joint.OtherBody != null) joint.OtherBody.AwakeBody(); joint.ParentBody = null; joint.OtherBody = null; joint.DestroyJoint(); }
/// <summary> /// Removes an existing joint from the Collider. /// </summary> /// <param name="joint"></param> public void RemoveJoint(JointInfo joint) { if (joint == null) throw new ArgumentNullException("joint"); if (joint.BodyA != this && joint.BodyB != this) return; if (joint.BodyA != null) { if (joint.BodyA.joints != null) joint.BodyA.joints.Remove(joint); joint.BodyA.AwakeBody(); joint.BodyA = null; } if (joint.BodyB != null) { if (joint.BodyB.joints != null) joint.BodyB.joints.Remove(joint); joint.BodyB.AwakeBody(); joint.BodyB = null; } joint.DestroyJoint(); }