Adaptive number of iterations of constraint solver
-
- Posts: 16
- Joined: Tue Sep 01, 2009 3:49 pm
- Location: Germany
Adaptive number of iterations of constraint solver
The constraint solver uses a constant number of iterations (m_numIterations) with a default value of 10. While this works fine in most cases, there are situations where you need a lot more iterations. For example, I have a cylinder which is mounted on a horizontal hinge with fixed position in the world. Now when I let a sphere fall down on the cylinder, the cylinder is pushed down and moves back to the correct hinge position within a few frames. To get the correct behaviour (no visual violation of hinge constraint, correct bounciness), I need several 100 iterations of the solver -- but just for such relatively rare collision events. Now is there a reason why the number of iterations isn't made adaptive (i.e., iterate as long as the solver makes velocity corrections above some threshold)?
-
- Posts: 16
- Joined: Tue Sep 01, 2009 3:49 pm
- Location: Germany
Re: Adaptive number of iterations of constraint solver
OK, that high number of iterations is due to a very large (and thus not recommended) mass ratio: the mass of the sphere is 300 times larger than that of the mounted cylinder. Nevertheless, my question remains if an adaptive number of iterations is a good or bad idea.