summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-01-30 11:02:50 +0100
committerGitHub <noreply@github.com>2019-01-30 11:02:50 +0100
commit629ac20a14920a6576ecf645c3a1c5e8e162a4ab (patch)
treec0dd3279ff2e7510813cadacc070db18661e7fbb
parent35bb52011a4cbcd8ca3779ab1761244f06a33127 (diff)
parent5a26c7e0e5e7a3589a4320b55a5284e4ecf17870 (diff)
Merge pull request #25489 from AndreaCatania/assert
Avoid inertia calculation for empty shape - Bullet
-rw-r--r--modules/bullet/rigid_body_bullet.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index 460ef043da..22f2214898 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -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();