By simply adding these lines of code:
if (distance < 0) {
float f_no[3];
cross_tri_v3(f_no, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co);
if (dot_v3v3(collpair->vector, f_no) < 0) {
negate_v3(collpair->vector);
}
}Problems involving the cloth entering in the object (as shown in the picture) are avoided.
This code tests if the collision points are moving away and if the cloth collision point is behind the face. Then reverses the vector indicating its movement if true.
A new option "Adjust to Outer Surface" is added to object collision settings.
Here a link to download a version of Blender compiled with this patch (Windows 64 bits):
https://www.dropbox.com/s/ksqpt67u1et2wnw/Release.zip?dl=0




