protected internal void UnsafeSolveIteration(SolverUpdateable updateable) { if (updateable.isActiveInSolver) { SolverSettings solverSettings = updateable.solverSettings; solverSettings.currentIterations++; if (solverSettings.currentIterations <= iterationLimit && solverSettings.currentIterations <= solverSettings.maximumIterationCount) { if (updateable.SolveIteration() < solverSettings.minimumImpulse) { solverSettings.iterationsAtZeroImpulse++; if (solverSettings.iterationsAtZeroImpulse > solverSettings.minimumIterationCount) { updateable.isActiveInSolver = false; } } else { solverSettings.iterationsAtZeroImpulse = 0; } } else { updateable.isActiveInSolver = false; } } }
/// <summary> /// Solves a child updateable. Some children may override the group's update method; /// this avoids code repeat. /// </summary> /// <param name="item"></param> /// <param name="activeConstraints"> </param> protected void SolveUpdateable(SolverUpdateable item, ref int activeConstraints) { if (item.isActiveInSolver) { SolverSettings subSolverSettings = item.solverSettings; subSolverSettings.currentIterations++; if (subSolverSettings.currentIterations <= solver.iterationLimit && subSolverSettings.currentIterations <= subSolverSettings.maximumIterationCount) { if (item.SolveIteration() < subSolverSettings.minimumImpulse) { subSolverSettings.iterationsAtZeroImpulse++; if (subSolverSettings.iterationsAtZeroImpulse > subSolverSettings.minimumIterationCount) { item.isActiveInSolver = false; } else { activeConstraints++; } } else { subSolverSettings.iterationsAtZeroImpulse = 0; activeConstraints++; } } else { item.isActiveInSolver = false; } } }