[Bf-blender-cvs] [92823275af6] blender2.8: Fixed rigid body simulation randomly stopping

Sybren A. Stüvel noreply at git.blender.org
Tue Jun 19 14:24:26 CEST 2018


Commit: 92823275af65c64e6edfeca3c513d64f5445640c
Author: Sybren A. Stüvel
Date:   Tue Jun 19 12:16:18 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB92823275af65c64e6edfeca3c513d64f5445640c

Fixed rigid body simulation randomly stopping

This was caused by a floating point comparison using ==, instead of using
compare_ff_relative().

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

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

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

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index eec0e8b387d..3012c1b7f99 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1631,7 +1631,7 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime
 	}
 
 	/* advance simulation, we can only step one frame forward */
-	if (ctime == rbw->ltime + 1) {
+	if (compare_ff_relative(ctime, rbw->ltime + 1, FLT_EPSILON, 64)) {
 		/* write cache for first frame when on second frame */
 		if (rbw->ltime == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0)) {
 			BKE_ptcache_write(&pid, startframe);



More information about the Bf-blender-cvs mailing list