From 887a5cd4f9cf4c914c7af292d685cd0ed064efc7 Mon Sep 17 00:00:00 2001 From: Ricardo Buring Date: Mon, 4 Apr 2022 11:07:57 +0200 Subject: [PATCH] SpaceBullet::recover_from_penetration: skip compound shapes without child shapes Before, this case would incorrectly get caught as an error, causing an early return, in particular skipping other possibly relevant shapes. --- modules/bullet/space_bullet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index 2f2c476d542..6ac1b540644 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -1256,6 +1256,9 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran if (otherObject->getCollisionShape()->isCompound()) { const btCompoundShape *cs = static_cast(otherObject->getCollisionShape()); + if (cs->getNumChildShapes() == 0) { + continue; // No shapes to depenetrate from. + } int shape_idx = recover_broad_result.results[i].compound_child_index; ERR_FAIL_COND_V(shape_idx < 0 || shape_idx >= cs->getNumChildShapes(), false);