Better fix for rigid body not resimulating
Last fix only accounted for direct changes to the RB settings, but failed for, say, object transformations. This fix accounts for any change that might invalidate the RB cache.
This commit is contained in:
parent
3edc8c1f9b
commit
b87d10d4fe
Notes:
blender-bot
2023-02-14 07:45:38 +01:00
Referenced by commit 4ad5df8858
, Fix T52374: Changes of rigid body related settings during simulation will break the simulation
Referenced by issue #52374, Changes of rigid body related settings during simulation will break the simulation (worked in 2.78c)
|
@ -1517,7 +1517,6 @@ void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw)
|
|||
{
|
||||
if (rbw) {
|
||||
rbw->pointcache->flag |= PTCACHE_OUTDATED;
|
||||
rbw->ltime = rbw->pointcache->startframe;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1580,6 +1579,10 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
|
|||
// RB_TODO deal with interpolated, old and baked results
|
||||
bool can_simulate = (ctime == rbw->ltime + 1) && !(cache->flag & PTCACHE_BAKED);
|
||||
|
||||
if (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0) {
|
||||
rbw->ltime = cache->startframe;
|
||||
}
|
||||
|
||||
if (BKE_ptcache_read(&pid, ctime, can_simulate)) {
|
||||
BKE_ptcache_validate(cache, (int)ctime);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue