diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-01-24 07:49:30 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-01-24 07:49:30 +0400 |
commit | 5489d5c2b5cb984112fe1b8dc1dbabbfbd6fb473 (patch) | |
tree | bb26a78ea62fb9f098d9438bc75a4a663d226154 /source/blender/blenkernel/intern/rigidbody.c | |
parent | aea3545973d65a8c65771c76ddd7945afffa0da2 (diff) |
rigidbody: Fix [#33971] Bullet Physics crash + patch
BKE_rigidbody_aftertrans_update() can be called before rigid body is
validated so check before updating physics_object.
Thanks to Antony Riakiotakis (psy-fi) for the initial patch.
Diffstat (limited to 'source/blender/blenkernel/intern/rigidbody.c')
-rw-r--r-- | source/blender/blenkernel/intern/rigidbody.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 2cbd0ebcb0a..7cab0d7471f 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1157,7 +1157,7 @@ void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], flo { RigidBodyOb *rbo = ob->rigidbody_object; - /* return rigid body and objext to their initial states */ + /* return rigid body and object to their initial states */ copy_v3_v3(rbo->pos, ob->loc); copy_v3_v3(ob->loc, loc); @@ -1174,7 +1174,8 @@ void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], flo copy_qt_qt(rbo->orn, ob->quat); copy_qt_qt(ob->quat, quat); } - RB_body_set_loc_rot(rbo->physics_object, rbo->pos, rbo->orn); + if (rbo->physics_object) + RB_body_set_loc_rot(rbo->physics_object, rbo->pos, rbo->orn); // RB_TODO update rigid body physics object's loc/rot for dynamic objects here as well (needs to be done outside bullet's update loop) } |