///<summary> /// Cleans up the pair handler. ///</summary> public override void CleanUp() { //The pair handler cleanup will get rid of contacts. foreach (var pairHandler in subPairs.Values) { pairHandler.CleanUp(); //Don't forget to give the pair back to the factory! //There'd be a lot of leaks otherwise. pairHandler.Factory.GiveBack(pairHandler); } subPairs.Clear(); //don't need to remove constraints directly from our group, since cleaning up our children should get rid of them. manifoldConstraintGroup.CleanUp(); base.CleanUp(); //Child type needs to null out the references. }
///<summary> /// Cleans up the pair handler. ///</summary> public override void CleanUp() { //The pair handler cleanup will get rid of contacts. foreach (var pairHandler in subPairs.Values) { //The contained pairs list pulled TriangleCollidables from a pool to create the opposing collidables. //Clean those up now. //CollidableA is used without checking, because MobileMeshPairHandlers always put the convex in slot A. CleanUpCollidable((TriangleCollidable)pairHandler.CollidableA); pairHandler.CleanUp(); //Don't forget to give the pair back to the factory! //There'd be a lot of leaks otherwise. pairHandler.Factory.GiveBack(pairHandler); } subPairs.Clear(); //don't need to remove constraints directly from our group, since cleaning up our children should get rid of them. manifoldConstraintGroup.CleanUp(); base.CleanUp(); //Child type needs to null out the references. }