From 9cd6b03187b91bb2c267a45eac3cee7738e0e220 Mon Sep 17 00:00:00 2001 From: Luca Rood Date: Fri, 30 Jun 2017 15:56:44 +0200 Subject: 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 --- source/blender/blenkernel/intern/rigidbody.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to '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; } -- cgit v1.2.3