public void DestroyJoint(InternalBaseJoint joint) { if (!Joints.Remove(joint)) { SysConsole.Output(OutputType.WARNING, "Destroyed non-existent joint?!"); } joint.One.Joints.Remove(joint); joint.Two.Joints.Remove(joint); joint.Disable(); if (joint is BaseJoint pjoint) { PhysicsWorld.Remove(pjoint.CurrentJoint); } }
/// <summary> /// Destroys a joint, removing it from the region. /// </summary> /// <param name="joint">The join to remove.</param> public void DestroyJoint(InternalBaseJoint joint) { Joints.Remove(joint); joint.One.Joints.Remove(joint); joint.Two.Joints.Remove(joint); joint.Disable(); if (joint is BaseJoint pjoint) { if (pjoint.CurrentJoint != null) { try { PhysicsWorld.Remove(pjoint.CurrentJoint); } catch (Exception ex) { // We don't really care... Utilities.CheckException(ex); } } } SendToAll(new DestroyJointPacketOut(joint)); }