private void ProcessRemovedItems() { //Remove any new geometries for (int i = 0; i < geomRemoveList.Count; i++) { geomRemoveList[i].isRemoved = true; geomList.Remove(geomRemoveList[i]); //Remove any arbiters associated with the geometries being removed for (int j = arbiterList.Count; j > 0; j--) { if (arbiterList[j - 1].GeometryA == geomRemoveList[i] || arbiterList[j - 1].GeometryB == geomRemoveList[i]) { arbiterList.Remove(arbiterList[j - 1]); } } } if (geomRemoveList.Count > 0) { _broadPhaseCollider.ProcessRemovedGeoms(); } geomRemoveList.Clear(); //Remove any new bodies for (int i = 0; i < bodyRemoveList.Count; i++) { bodyList.Remove(bodyRemoveList[i]); } bodyRemoveList.Clear(); //Remove any new controllers for (int i = 0; i < controllerRemoveList.Count; i++) { controllerList.Remove(controllerRemoveList[i]); } controllerRemoveList.Clear(); //Remove any new joints for (int i = 0; i < jointRemoveList.Count; i++) { jointList.Remove(jointRemoveList[i]); } jointRemoveList.Clear(); //Remove any new springs for (int i = 0; i < springRemoveList.Count; i++) { springList.Remove(springRemoveList[i]); } springRemoveList.Clear(); }
/// <summary> /// Processes the removed geometries (and their arbiters), bodies, controllers, joints and springs. /// </summary> private void ProcessRemovedItems() { //Remove any new geometries _tempCount = _geomRemoveList.Count; for (int i = 0; i < _tempCount; i++) { _geomRemoveList[i].InSimulation = false; GeomList.Remove(_geomRemoveList[i]); //Remove any arbiters associated with the geometries being removed for (int j = ArbiterList.Count; j > 0; j--) { if (ArbiterList[j - 1].GeometryA == _geomRemoveList[i] || ArbiterList[j - 1].GeometryB == _geomRemoveList[i]) { //TODO: Should we create a RemoveComplete method and remove all Contacts associated //with the arbiter? arbiterPool.Insert(ArbiterList[j - 1]); ArbiterList.Remove(ArbiterList[j - 1]); } } } if (_geomRemoveList.Count > 0) { _broadPhaseCollider.ProcessRemovedGeoms(); } _geomRemoveList.Clear(); //Remove any new bodies _tempCount = _bodyRemoveList.Count; for (int i = 0; i < _tempCount; i++) { BodyList.Remove(_bodyRemoveList[i]); } _bodyRemoveList.Clear(); //Remove any new controllers _tempCount = _controllerRemoveList.Count; for (int i = 0; i < _tempCount; i++) { ControllerList.Remove(_controllerRemoveList[i]); } _controllerRemoveList.Clear(); //Remove any new joints int jointRemoveCount = _jointRemoveList.Count; for (int i = 0; i < jointRemoveCount; i++) { JointList.Remove(_jointRemoveList[i]); } _jointRemoveList.Clear(); //Remove any new springs _tempCount = _springRemoveList.Count; for (int i = 0; i < _tempCount; i++) { SpringList.Remove(_springRemoveList[i]); } _springRemoveList.Clear(); }