   Constraints + collision resolution
  Hello.I'm trying to write a physics engine and look for advise. I need constraints for my engine and I'm usind method from famous Thomas Jakobsen article 'Advanced Character Phisycs'. I have iterations number of, say, 10.Also I'm looking for penetration of objects with separate axis theorem, which also need several iterations. And now question - what algorithm should I use for better perfomance.Currently I use this in each frame:1. Find forces.2. Satisfy constraints in current iteration.3. Run through all shapes to find penetration and resolve penetration.4. Increase iteration and go to p.2 if iterations left.5. Set new velocities to my shapes.Is it right or I miss something.?   
  A typical approach is to resolve collisions/penetrations and constraints in a single iteration loop, rather than solve constraints, then penetration, then possibly go back to resolve constraints again. These things, penetration included, are all, after all, constraints that have to be satisfied together, not separately. So, the challenge is to set up a system that treats penetration constraints together with rigid body constraints. I'm aware of the Jakobsen article, and know its pretty popular...but I've never read it to see how his approach deals with all this. So I can't really comment on that. I can say that the commercial and open source physics engines do typically have constraint solvers that can do what I said. At the start of each frame, they determine object/object contact (e.g., they might be touching, might have collided, might have interpenetrated...) and create new, temporary constraint for the duration of that frame. The new contact constraint gets put into the system of constraints, along with rigid body constraints, then the whole set gets sent to the constraint solver (which might be an iterative solver). After all the constraints are resolved, the contact constraints are removed and then the time integration is done to move the objects.   ;  Thank you. Very interesting.   