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

Requires compiling Bullet in debug mode to reproduce.
This commit is contained in:
rdb 2019-03-03 21:13:36 +01:00
parent fa6c066b2f
commit 92993fe889

View File

@ -120,7 +120,7 @@ do_set_mass(PN_stdfloat mass) {
btScalar bt_mass = mass; btScalar bt_mass = mass;
btVector3 bt_inertia(0.0, 0.0, 0.0); 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); _rigid->getCollisionShape()->calculateLocalInertia(bt_mass, bt_inertia);
} }