From 92993fe8891257aed9d12967bd0fff0af03adfc4 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 3 Mar 2019 21:13:36 +0100 Subject: [PATCH] bullet: fix assert when setting mass before shape (#571) Requires compiling Bullet in debug mode to reproduce. --- panda/src/bullet/bulletRigidBodyNode.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/bullet/bulletRigidBodyNode.cxx b/panda/src/bullet/bulletRigidBodyNode.cxx index 6f5bff0d46..b97f768d1b 100644 --- a/panda/src/bullet/bulletRigidBodyNode.cxx +++ b/panda/src/bullet/bulletRigidBodyNode.cxx @@ -120,7 +120,7 @@ do_set_mass(PN_stdfloat mass) { btScalar bt_mass = mass; btVector3 bt_inertia(0.0, 0.0, 0.0); - if (bt_mass > 0.0) { + if (bt_mass > 0.0 && !_shapes.empty()) { _rigid->getCollisionShape()->calculateLocalInertia(bt_mass, bt_inertia); }