[Bf-blender-cvs] [4f504d5] temp_merge_gooseberry_hair: Fix for collision response, the impulse response was far too small.

Lukas Tönne noreply at git.blender.org
Mon Jan 19 20:48:10 CET 2015


Commit: 4f504d526a574e68f59e2029223d3ddce2b8ab4e
Author: Lukas Tönne
Date:   Thu Sep 4 15:05:12 2014 +0200
Branches: temp_merge_gooseberry_hair
https://developer.blender.org/rB4f504d526a574e68f59e2029223d3ddce2b8ab4e

Fix for collision response, the impulse response was far too small.

===================================================================

M	source/blender/blenkernel/intern/collision.c
M	source/blender/blenkernel/intern/implicit.c

===================================================================

diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 78cb468..1e742d5 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -1020,7 +1020,7 @@ bool cloth_points_collpair_response(ClothModifierData *clmd, CollisionModifierDa
 		repulse = -margin_distance / dt + dot_v3v3(v1, collpair->normal);
 		
 		if (margin_distance < -epsilon2) {
-			bounce = -v_nor_new + v_nor_old * restitution;
+			bounce = -(v_nor_new + v_nor_old * restitution);
 			mul_v3_v3fl(r_impulse, collpair->normal, max_ff(repulse, bounce));
 		}
 		else {
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 45a8ff5..6e0a9d7 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -1798,13 +1798,10 @@ static void setup_constraint_matrix(ClothModifierData *clmd, ColliderContacts *c
 				continue;
 			
 			/* calculate collision response */
-//			if (!cloth_points_collpair_response(clmd, ct->collmd, ct->ob->pd, collpair, dt, impulse))
-//				continue;
-			cloth_points_collpair_response(clmd, ct->collmd, ct->ob->pd, collpair, dt, impulse);
+			if (!cloth_points_collpair_response(clmd, ct->collmd, ct->ob->pd, collpair, dt, impulse))
+				continue;
 			
-//			add_v3_v3(z[v], impulse);
-			negate_v3_v3(z[v], V[v]);
-//			sub_v3_v3(z[v], verts[v].v);
+			add_v3_v3(z[v], impulse);
 			
 			/* modify S to enforce velocity constraint in normal direction */
 			mul_fvectorT_fvector(cmat, collpair->normal, collpair->normal);
@@ -1813,7 +1810,8 @@ static void setup_constraint_matrix(ClothModifierData *clmd, ColliderContacts *c
 			BKE_sim_debug_data_add_dot(clmd->debug_data, collpair->pa, 0, 1, 0, "collision", hash_collpair(936, collpair));
 			BKE_sim_debug_data_add_dot(clmd->debug_data, collpair->pb, 1, 0, 0, "collision", hash_collpair(937, collpair));
 			BKE_sim_debug_data_add_line(clmd->debug_data, collpair->pa, collpair->pb, 0.7, 0.7, 0.7, "collision", hash_collpair(938, collpair));
-			{
+			
+			{ /* DEBUG */
 //				float nor[3];
 //				mul_v3_v3fl(nor, collpair->normal, collpair->distance);
 //				BKE_sim_debug_data_add_vector(clmd->debug_data, collpair->pb, nor, 1, 1, 0, "collision", hash_collpair(939, collpair));




More information about the Bf-blender-cvs mailing list