Procházet zdrojové kódy

Merge pull request #25489 from AndreaCatania/assert

Avoid inertia calculation for empty shape - Bullet
Rémi Verschelde před 6 roky
rodič
revize
629ac20a14
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      modules/bullet/rigid_body_bullet.cpp

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