From 97feb6bd97372543af615d9220cd2aa88893d725 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 18 Jan 2011 22:37:58 +0000 Subject: [PATCH] remove unneeded and troublesome CollisionSolid == CollisionSolid optimization --- panda/src/collide/collisionTraverser.cxx | 29 +++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/panda/src/collide/collisionTraverser.cxx b/panda/src/collide/collisionTraverser.cxx index 1fb447694c..718bd0854b 100644 --- a/panda/src/collide/collisionTraverser.cxx +++ b/panda/src/collide/collisionTraverser.cxx @@ -1195,21 +1195,24 @@ compare_collider_to_node(CollisionEntry &entry, << " which has " << num_solids << " collision solids.\n"; for (int s = 0; s < num_solids; ++s) { entry._into = cnode->get_solid(s); - if (entry._from != entry._into) { - CPT(BoundingVolume) solid_bv = entry._into->get_bounds(); - const GeometricBoundingVolume *solid_gbv = NULL; - if (num_solids > 1 && - solid_bv->is_of_type(GeometricBoundingVolume::get_class_type())) { - // Only bother to test against each solid's bounding - // volume if we have more than one solid in the node, as a - // slight optimization. (If the node contains just one - // solid, then the node's bounding volume, which we just - // tested, is the same as the solid's bounding volume.) - DCAST_INTO_V(solid_gbv, solid_bv); - } - compare_collider_to_solid(entry, from_node_gbv, solid_gbv); + // We should allow a collision test for solid into itself, + // because the solid might be simply instanced into multiple + // different CollisionNodes. We are already filtering out tests + // for a CollisionNode into itself. + CPT(BoundingVolume) solid_bv = entry._into->get_bounds(); + const GeometricBoundingVolume *solid_gbv = NULL; + if (num_solids > 1 && + solid_bv->is_of_type(GeometricBoundingVolume::get_class_type())) { + // Only bother to test against each solid's bounding + // volume if we have more than one solid in the node, as a + // slight optimization. (If the node contains just one + // solid, then the node's bounding volume, which we just + // tested, is the same as the solid's bounding volume.) + DCAST_INTO_V(solid_gbv, solid_bv); } + + compare_collider_to_solid(entry, from_node_gbv, solid_gbv); } } }