Merge pull request #25489 from AndreaCatania/assert

Avoid inertia calculation for empty shape - Bullet
This commit is contained in:
Rémi Verschelde 2019-01-30 11:02:50 +01:00 committed by GitHub
commit 629ac20a14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -825,7 +825,8 @@ void RigidBodyBullet::reload_shapes() {
// shapes incorrectly do not set the vector in calculateLocalIntertia.
// Arbitrary zero is preferable to undefined behaviour.
btVector3 inertia(0, 0, 0);
mainShape->calculateLocalInertia(mass, inertia);
if (EMPTY_SHAPE_PROXYTYPE != mainShape->getShapeType()) // Necessary to avoid assertion of the empty shape
mainShape->calculateLocalInertia(mass, inertia);
btBody->setMassProps(mass, inertia);
}
btBody->updateInertiaTensor();