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 /intern/rigidbody/rb_bullet_api.cpp | |
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 'intern/rigidbody/rb_bullet_api.cpp')
-rw-r--r-- | intern/rigidbody/rb_bullet_api.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp index b5814055cf8..daa377a7b55 100644 --- a/intern/rigidbody/rb_bullet_api.cpp +++ b/intern/rigidbody/rb_bullet_api.cpp @@ -649,6 +649,16 @@ void RB_body_get_orientation(rbRigidBody *object, float v_out[4]) copy_quat_btquat(v_out, body->getWorldTransform().getRotation()); } +void RB_body_get_scale(rbRigidBody *object, float v_out[3]) +{ + btRigidBody *body = object->body; + + btCollisionShape *cshape = body->getCollisionShape(); + /* The body should have a collision shape when we try to set the scale. */ + btAssert(cshape); + copy_v3_btvec3(v_out, cshape->getLocalScaling()); +} + /* ............ */ /* Overrides for simulation */ |