[Bf-blender-cvs] [c8d1bbf31c] cloth-improvements: Fix collision distance calculation (makes collisions perfectly inelastic)

Luca Rood noreply at git.blender.org
Wed Jan 18 01:33:40 CET 2017


Commit: c8d1bbf31c3f7a0a31cc574d1ca3b7128310fcd6
Author: Luca Rood
Date:   Tue Jan 17 22:05:25 2017 -0200
Branches: cloth-improvements
https://developer.blender.org/rBc8d1bbf31c3f7a0a31cc574d1ca3b7128310fcd6

Fix collision distance calculation (makes collisions perfectly inelastic)

Collision distance was computed with respect to the positions before the
pre-collision solve, but should rather be computed with respect to the
newly solved positions.

This fixes the issue of the collisions being semi-elastic (bouncy),
making them pretty much perfectly inelastic. This also improves the
effectiveness of the collision response, preventing penetrations even
with far less collision steps.

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

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

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

diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 46d82784e4..5fe238a8cb 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -488,7 +488,7 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
 #ifdef WITH_BULLET
 		// calc distance + normal
 		distance = plNearestPoints (
-			verts1[collpair->ap1].txold, verts1[collpair->ap2].txold, verts1[collpair->ap3].txold, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, collpair->pa, collpair->pb, collpair->vector );
+			verts1[collpair->ap1].tx, verts1[collpair->ap2].tx, verts1[collpair->ap3].tx, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, collpair->pa, collpair->pb, collpair->vector );
 #else
 		// just be sure that we don't add anything
 		distance = 2.0 * (double)( epsilon1 + epsilon2 + ALMOST_ZERO );




More information about the Bf-blender-cvs mailing list