float friction_coeff = 0.1f;
float inv_mass_sum = entity1.inverse_mass+entity2.inverse_mass;
float reaction = (1+restitution)*inner_product(v_rel, c.normal)/inv_mass_sum;
- float friction = reaction*friction_coeff;
+ float friction = min(reaction*friction_coeff, v_tan/inv_mass_sum);
LinAl::Vector<float, 2> impulse = c.normal*reaction+tangent*friction;
entity1.velocity += impulse*entity1.inverse_mass;
entity2.velocity -= impulse*entity2.inverse_momi;