Merge pull request #59864 from rburing/bullet_skip_depenetrate_from_void_3.x

This commit is contained in:
Rémi Verschelde 2022-04-29 14:41:31 +02:00 committed by GitHub
commit 288dbe41a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -1256,6 +1256,9 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
if (otherObject->getCollisionShape()->isCompound()) { if (otherObject->getCollisionShape()->isCompound()) {
const btCompoundShape *cs = static_cast<const btCompoundShape *>(otherObject->getCollisionShape()); const btCompoundShape *cs = static_cast<const btCompoundShape *>(otherObject->getCollisionShape());
if (cs->getNumChildShapes() == 0) {
continue; // No shapes to depenetrate from.
}
int shape_idx = recover_broad_result.results[i].compound_child_index; int shape_idx = recover_broad_result.results[i].compound_child_index;
ERR_FAIL_COND_V(shape_idx < 0 || shape_idx >= cs->getNumChildShapes(), false); ERR_FAIL_COND_V(shape_idx < 0 || shape_idx >= cs->getNumChildShapes(), false);