I'm developing a physics engine at my university (UFJF, Brazil) and I've followed Eberly's book, Game Physics.
Now, i can deal with multiple contacts and resting contacts with restitution using LCP (Lemke-Howson algorithm), but I have some questions and I'm asking for your help:
-The first LCP Solver receives the A matrix and a vector called "Vector B" and gives me the post impulse velocities and the impulses that i have to apply. (This Vector B has elements bi = 0 if (preImpulseVelocity >=0 ), else it is bi= 2 * preImpulseVelocity. I didn't understand something: Why i have to multiply the preImpulseVelocity by 2?)
-Now I need to add friction, but i don't know exactly what to do.. I've found a lot of papers, but i'm a little confused yet. For example, in http://www.dh.aist.go.jp/~kawachi/ca98/ca98kawachi.pdf he says:
- i have to decompose my velocity into normal and tangent variables,
that's ok, all i have to do is to project my preImpulseVelocity into the normal and the tangential direction, right? - well, i have doubled the size of my preImpulseVelocity vector, so i need to double the size of A matrix, but how? what's the new formula for it?
Thank you very much

TK