From 5489d5c2b5cb984112fe1b8dc1dbabbfbd6fb473 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Thu, 24 Jan 2013 03:49:30 +0000 Subject: 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. --- source/blender/blenkernel/intern/rigidbody.c | 5 +++-- 1 file changed, 3 insertions(+), 2 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 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) } -- cgit v1.2.3