[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47335] trunk/blender/source/blender/ blenkernel/intern/collision.c: Followup fix Bugfix [#31629]: Cloth simulation collisions used still too high repulsions.

Daniel Genrich daniel.genrich at gmx.net
Fri Jun 1 18:50:13 CEST 2012


Revision: 47335
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47335
Author:   genscher
Date:     2012-06-01 16:50:12 +0000 (Fri, 01 Jun 2012)
Log Message:
-----------
Followup fix Bugfix [#31629]: Cloth simulation collisions used still too high repulsions.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/collision.c

Modified: trunk/blender/source/blender/blenkernel/intern/collision.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/collision.c	2012-06-01 15:49:39 UTC (rev 47334)
+++ trunk/blender/source/blender/blenkernel/intern/collision.c	2012-06-01 16:50:12 UTC (rev 47335)
@@ -302,6 +302,10 @@
 
 			// Apply repulse impulse if distance too short
 			// I_r = -min(dt*kd, m(0, 1d/dt - v_n))
+			// DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this:
+			// v += impulse; x_new = x + v; 
+			// We don't use dt!!
+			// DG TODO: Fix usage of dt here!
 			spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
 
 			d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance;
@@ -324,15 +328,18 @@
 		else
 		{
 			// Apply repulse impulse if distance too short
-			// I_r = -min(dt*kd, m(0, 1d/dt - v_n))
+			// I_r = -min(dt*kd, max(0, 1d/dt - v_n))
+			// DG: this formula ineeds to be changed for this code since we apply impulses/repulses like this:
+			// v += impulse; x_new = x + v; 
+			// We don't use dt!!
 			float spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
 
 			float d = clmd->coll_parms->epsilon*8.0f/9.0f + epsilon2*8.0f/9.0f - collpair->distance;
 			if ( d > ALMOST_ZERO) {
 				// stay on the safe side and clamp repulse
-				float repulse = d*1.0f/spf;
+				float repulse = d;
 
-				float impulse = repulse / (3.0f * ( 1.0f + w1*w1 + w2*w2 + w3*w3 )); // original 2.0 / 0.25
+				float impulse = repulse / (( 1.0f + w1*w1 + w2*w2 + w3*w3 )); // original 2.0 / 0.25
 				VECADDMUL ( i1, collpair->normal,  impulse );
 				VECADDMUL ( i2, collpair->normal,  impulse );
 				VECADDMUL ( i3, collpair->normal,  impulse );




More information about the Bf-blender-cvs mailing list