Seth wrote:

hi, you're right, jellophysics seems to use springs which do not have endless stiffness. (easy to implement, because it only affects the length constraints of the polygon)

The problem is that I don't know what to do next, how to add friction, elasticity and collision response.

As I said, collision response is made by simply moving the mass points so there is no overlap. You don't need to care about velocity, because it is changed implicitly.

If you want to add some bouncing then move last_pos of the mass point along -normal*CoR where "last_pos" is a last position of the mass point (you need to store this if you work with velocity less Verlet), "normal" is a collision normal (along which you moved the mass point in order to solve the overlap) and "CoR" is a coefficient of restitution between 0 and 1.

If you collide with static objects then you can simulate the friction by simply decreasing "velocity", so make last_pos+=(pos-last_pos)*CoF where "CoF" is a coefficient of friction. It seems strange but works nicely for me

Perhaps it would be more accurate as if I did it the same way as with dynamic objects.

Friction of collision with a dynamic body is a little more tricky. You need to calculate relative velocity of colliding points. Let's assume your mass point I collided with and edge (defined by mass points J and K) of the other object (1 point vs 1 point is just a simpler scenario). Then the relative velocity is relVel = I.pos - I.last_pos - (J.pos + K.pos - J.last_pos - K.last_pos)/2. Then you compute tangent from the collision normal and project the relative velocity onto it:

relTanVel = tagent*dot(relVel, tangent)

Then you add/subtract (depending on how you computed tangent) some fraction of relTanVel to/from last_pos of I,J,K. What fraction it will be is determined by I,J,K masses and "hit coefficient" (because I is somewhere between J and K...you get the hit coefficient by projecting I onto the edge JK).

Again, this is probably not very accurate, but works fine for me and it looks good in the cases I needed. If you need something more accurate then mass-spring system for simulating bodies is maybe not a good idea, but as I remember you wanted something simple.