BEPUphysics.SolverSystems.Solver.Remove C# (CSharp) Method

Remove() public method

Removes a solver updateable from the solver.
Thrown when the item does not belong to the solver.
public Remove ( SolverUpdateable item ) : void
item SolverUpdateable Updateable to remove.
return void
        public void Remove(SolverUpdateable item)
        {

            if (item.Solver == this)
            {

                item.Solver = null;
                solverUpdateables.Count--;
                if (item.solverIndex < solverUpdateables.Count)
                {
                    //The solver updateable isn't the last element, so put the last element in its place.
                    solverUpdateables.Elements[item.solverIndex] = solverUpdateables.Elements[solverUpdateables.Count];
                    //Update the replacement's solver index to its new location.
                    solverUpdateables.Elements[item.solverIndex].solverIndex = item.solverIndex;
                }
                solverUpdateables.Elements[solverUpdateables.Count] = null;


                DeactivationManager.Remove(item.simulationIslandConnection);
                item.OnRemovalFromSolver(this);
            }

            else
                throw new ArgumentException("Solver updateable doesn't belong to this solver; it can't be removed.", "item");

        }