Browse Source

bullet: fix assert when setting mass before shape (#571)

Requires compiling Bullet in debug mode to reproduce.
rdb 6 years ago
parent
commit
92993fe889
1 changed files with 1 additions and 1 deletions
  1. 1 1
      panda/src/bullet/bulletRigidBodyNode.cxx

+ 1 - 1
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);
   }