浏览代码

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.
Ricardo Buring 3 年之前
父节点
当前提交
887a5cd4f9
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      modules/bullet/space_bullet.cpp

+ 3 - 0
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<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;
 				ERR_FAIL_COND_V(shape_idx < 0 || shape_idx >= cs->getNumChildShapes(), false);