How to interpret the force value retuend by softbody_calc_forces() in softbody.c?

As a follow-up to this, I am trying to get access to Normal and Tangential forces of soft body objects during physics simulation . With the help of one of the community members I learned that the function static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, float timenow) calculates forces between colliding meshes and returns a single value (I think it sums them up). I wonder, are those forces the Normal and Tangential forces? If not, what are those forces and how can I decouple them? Where are the equations through which these forces are calculated?

I don’t really understand this code, and it seems there’s multiple places where normal and tangential forces are computed, for collision with other objects, self collision, etc.

But for example these lines seem to add tangential and normal forces respectively?

sub_v3_v3v3(cfforce, bp->vec, vel);
madd_v3_v3fl(bp->force, cfforce, -cf * 50.0f);

madd_v3_v3fl(bp->force, defforce, kd);

Where maybe “cf” stands for “collision friction” along the tangent and “defforce” for a “deflection force” along the normal.

1 Like