[Bf-blender-cvs] [9cd6b03187b] master: Fix T50230: Rigid Body simulation shouldn't step when time is beyond cached area

Luca Rood noreply at git.blender.org
Fri Jun 30 16:02:31 CEST 2017


Commit: 9cd6b03187b91bb2c267a45eac3cee7738e0e220
Author: Luca Rood
Date:   Fri Jun 30 15:56:44 2017 +0200
Branches: master
https://developer.blender.org/rB9cd6b03187b91bb2c267a45eac3cee7738e0e220

Fix T50230: Rigid Body simulation shouldn't step when time is beyond cached area

This makes the last time (`ltime`) stored in the rigid body world (`rbw`)
only be updated once a simulation step actually occurs, this prevents
another simulation step from being solved unless the current time is
exactly one frame after the last cached frame. Thus this prevents the
formation of gaps in the cache, such as seen in T50230.

Reviewers: mont29, sergey, angavrilov

Tags: #physics

Maniphest Tasks: T50230

Differential Revision: https://developer.blender.org/D2458

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

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

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

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 390e6dedc3f..c4fb0aec97b 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1563,12 +1563,8 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
 	BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
 	cache = rbw->pointcache;
 
-	if (ctime <= startframe) {
-		rbw->ltime = startframe;
-		return;
-	}
 	/* make sure we don't go out of cache frame range */
-	else if (ctime > endframe) {
+	if (ctime > endframe) {
 		ctime = endframe;
 	}
 
@@ -1584,7 +1580,6 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
 
 	if (BKE_ptcache_read(&pid, ctime, can_simulate)) {
 		BKE_ptcache_validate(cache, (int)ctime);
-		rbw->ltime = ctime;
 		return;
 	}




More information about the Bf-blender-cvs mailing list