Browse Source

continue looking for further intersections against remaining triangles in a geom

David Rose 23 years ago
parent
commit
c2f3a412dd
2 changed files with 11 additions and 12 deletions
  1. 7 7
      panda/src/collide/collisionPolygon.cxx
  2. 4 5
      panda/src/collide/collisionTraverser.cxx

+ 7 - 7
panda/src/collide/collisionPolygon.cxx

@@ -145,12 +145,12 @@ xform(const LMatrix4f &mat) {
   // and then convert them back.  Hopefully we won't lose too much
   // precision during all of this.
 
-  if (collide_cat.is_debug()) {
-    collide_cat.debug()
+  if (collide_cat.is_spam()) {
+    collide_cat.spam()
       << "CollisionPolygon transformed by:\n";
-    mat.write(collide_cat.debug(false), 2);
+    mat.write(collide_cat.spam(false), 2);
     if (_points.empty()) {
-      collide_cat.debug(false)
+      collide_cat.spam(false)
         << "  (no points)\n";
     }
   }
@@ -627,12 +627,12 @@ setup_points(const LPoint3f *begin, const LPoint3f *end) {
     }
   }
 
-  if (collide_cat.is_debug()) {
-    collide_cat.debug()
+  if (collide_cat.is_spam()) {
+    collide_cat.spam()
       << "CollisionPolygon defined with " << num_points << " vertices:\n";
     const LPoint3f *pi;
     for (pi = begin; pi != end; ++pi) {
-      collide_cat.debug(false) << "  " << (*pi) << "\n";
+      collide_cat.spam(false) << "  " << (*pi) << "\n";
     }
   }
 #endif

+ 4 - 5
panda/src/collide/collisionTraverser.cxx

@@ -601,11 +601,10 @@ compare_collider_to_geom(CollisionEntry &entry, Geom *geom,
                                           coords[tris[i + 2]])) {
         // Generate a temporary CollisionPolygon on the fly for each
         // triangle in the Geom.
-        CollisionPolygon poly(coords[tris[i]], coords[tris[i + 1]],
-                              coords[tris[i + 2]]);
-        if (entry.get_from()->test_intersection((*ci).second, entry, &poly) != 0) {
-          return;
-        }
+        entry._into =
+          new CollisionPolygon(coords[tris[i]], coords[tris[i + 1]],
+                               coords[tris[i + 2]]);
+        entry.get_from()->test_intersection((*ci).second, entry, entry.get_into());
       }
     }
   }