diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2020-09-02 15:14:47 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2020-09-02 15:20:41 +0300 |
commit | 1aa54d4921c2e8d7114f463a940c169ee573f557 (patch) | |
tree | 902f7f8c82fbeb16acb5d569fafc8423e58dd7a9 /source/blender/blenloader | |
parent | feb4b645d70ec8ad5c3f91a957738a9fba4054f0 (diff) |
Make rigidbody simulation handle animated objects gracefully
The animated objects was not updated for each internal substep for the rigidbody sim.
This would lead to unstable simulations or very annoying clipping artifacts.
Updated the code to use explicit substeps and tie it to the scene frame rate.
Fix T47402: Properly updating the animated objects fixes the reported issue.
Reviewed By: Brecht, Jacques
Differential Revision: http://developer.blender.org/D8762
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 3c326565557..269c2083ef4 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -33,6 +33,7 @@ #include "DNA_gpencil_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" +#include "DNA_rigidbody_types.h" #include "DNA_screen_types.h" #include "DNA_shader_fx_types.h" @@ -518,6 +519,23 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { + RigidBodyWorld *rbw = scene->rigidbody_world; + + if (rbw == NULL) { + continue; + } + + /* The substep method changed from "per second" to "per frame". + * To get the new value simply divide the old bullet sim fps with the scene fps. + */ + rbw->substeps_per_frame /= FPS; + + if (rbw->substeps_per_frame <= 0) { + rbw->substeps_per_frame = 1; + } + } + /** * Versioning code until next subversion bump goes here. * |