[Bf-blender-cvs] [1ecdfe2] hair_immediate_fixes: Desperate attempt to get stable collisions: Disable restitution and handle only one collision contact at a time.
Lukas Tönne
noreply at git.blender.org
Fri Sep 12 16:48:46 CEST 2014
Commit: 1ecdfe22a6c9b0862a3f8342b941f26f1a63d286
Author: Lukas Tönne
Date: Fri Sep 12 16:46:47 2014 +0200
Branches: hair_immediate_fixes
https://developer.blender.org/rB1ecdfe22a6c9b0862a3f8342b941f26f1a63d286
Desperate attempt to get stable collisions: Disable restitution and
handle only one collision contact at a time.
Collision still randomly explodes, even with differing results on the
same file. This could indicate a threading issue, possibly also related
to the dependency graph since multiple objects are involved in
collisions.
===================================================================
M source/blender/blenkernel/intern/implicit.c
===================================================================
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 49dc6dd..ecb2a52 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -2376,13 +2376,16 @@ static void setup_constraint_matrix(ClothModifierData *clmd, ColliderContacts *c
zero_v3(z[v]);
unit_m3(S[v].m);
}
+
+ verts[v].impulse_count = 0;
}
for (i = 0; i < totcolliders; ++i) {
ColliderContacts *ct = &contacts[i];
for (j = 0; j < ct->totcollisions; ++j) {
CollPair *collpair = &ct->collisions[j];
- float restitution = (1.0f - clmd->coll_parms->damping) * (1.0f - ct->ob->pd->pdef_sbdamp);
+// float restitution = (1.0f - clmd->coll_parms->damping) * (1.0f - ct->ob->pd->pdef_sbdamp);
+ float restitution = 0.0f;
int v = collpair->face1;
float cnor[3], cmat[3][3];
float impulse[3];
@@ -2397,11 +2400,15 @@ static void setup_constraint_matrix(ClothModifierData *clmd, ColliderContacts *c
vel_world_to_root(impulse, X[v], impulse, &roots[v]);
add_v3_v3(z[v], impulse);
+ ++verts[v].impulse_count;
+ if (verts[v].impulse_count > 1)
+ continue;
/* modify S to enforce velocity constraint in normal direction */
copy_v3_v3(cnor, collpair->normal);
mul_transposed_m3_v3(roots[v].rot, cnor);
mul_fvectorT_fvector(cmat, cnor, cnor);
+
sub_m3_m3m3(S[v].m, I, cmat);
BKE_sim_debug_data_add_dot(clmd->debug_data, collpair->pa, 0, 1, 0, "collision", hash_collpair(936, collpair));
More information about the Bf-blender-cvs
mailing list