Index: branches/cr/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- branches/cr/src/lib/collision_detection/obb_tree_node.cc	(revision 7955)
+++ branches/cr/src/lib/collision_detection/obb_tree_node.cc	(revision 7957)
@@ -481,33 +481,79 @@
     PRINTF(5)("collision @ lvl %i, object %s vs. %s, (%p, %p)\n", this->depth, nodeA->getClassName(), nodeB->getClassName(), this->nodeLeft, this->nodeRight);
 
-    /* check if left node overlaps */
+
+    // left node
     if( this->nodeLeft != NULL )
     {
-      PRINTF(5)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex());
       if( this->overlapTest(this->nodeLeft->bvElement, treeNode->bvElement, nodeA, nodeB))
       {
-        this->nodeLeft->collideWith(treeNode->nodeLeft, nodeA, nodeB);
-        this->nodeLeft->collideWith(treeNode->nodeRight, nodeA, nodeB);
+        if( treeNode->nodeLeft != NULL)
+          this->nodeLeft->collideWith(treeNode->nodeLeft, nodeA, nodeB);
+        if( treeNode->nodeRight != NULL)
+          this->nodeLeft->collideWith(treeNode->nodeRight, nodeA, nodeB);
       }
     }
+
+    // right node
+    if( this->nodeRight != NULL )
+    {
+      if( this->overlapTest(this->nodeRight->bvElement, treeNode->bvElement, nodeA, nodeB))
+      {
+        if( treeNode->nodeLeft != NULL)
+          this->nodeRight->collideWith(treeNode->nodeLeft, nodeA, nodeB);
+        if( treeNode->nodeRight != NULL)
+          this->nodeRight->collideWith(treeNode->nodeRight, nodeA, nodeB);
+      }
+    }
+
+
+    // hybrid mode: we reached the end of this obbtree, now reach the end of the other tree
+    if( this->nodeLeft == NULL && this->nodeRight == NULL)
+    {
+      if( treeNode->nodeLeft != NULL)
+        this->collideWith(treeNode->nodeLeft, nodeA, nodeB);
+      if( treeNode->nodeRight != NULL)
+        this->collideWith(treeNode->nodeRight, nodeA, nodeB);
+    }
+
+
+    // now check if we reached the end of both trees
+    if( unlikely((this->nodeRight == NULL && this->nodeLeft == NULL) &&
+        (treeNode->nodeRight == NULL && treeNode->nodeLeft == NULL)) )
+    {
+      nodeA->registerCollision(nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement);
+    }
+
+
+
+    /* check if left node overlaps */
+//     if( this->nodeLeft != NULL )
+//     {
+//       PRINTF(5)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex());
+//       if( this->overlapTest(this->nodeLeft->bvElement, treeNode->bvElement, nodeA, nodeB))
+//       {
+//         this->nodeLeft->collideWith(treeNode->nodeLeft, nodeA, nodeB);
+//         this->nodeLeft->collideWith(treeNode->nodeRight, nodeA, nodeB);
+//       }
+//     }
+
     /* check if right node overlaps */
-    if( likely( this->nodeRight != NULL))
-    {
-      PRINTF(5)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex());
-      if(this->overlapTest(this->nodeRight->bvElement, treeNode->bvElement, nodeA, nodeB))
-      {
-        this->nodeRight->collideWith(treeNode->nodeLeft, nodeA, nodeB);
-        this->nodeRight->collideWith(treeNode->nodeRight, nodeA, nodeB);
-      }
-    }
+//     if( likely( this->nodeRight != NULL))
+//     {
+//       PRINTF(5)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex());
+//       if(this->overlapTest(this->nodeRight->bvElement, treeNode->bvElement, nodeA, nodeB))
+//       {
+//         this->nodeRight->collideWith(treeNode->nodeLeft, nodeA, nodeB);
+//         this->nodeRight->collideWith(treeNode->nodeRight, nodeA, nodeB);
+//       }
+//     }
 
     /* so there is a collision and this is the last box in the tree (i.e. leaf) */
-    if( unlikely((this->nodeRight == NULL || this->nodeLeft == NULL) ||
-                 (treeNode->nodeRight == NULL || treeNode->nodeLeft == NULL)) )
-    {
+//     if( unlikely((this->nodeRight == NULL || this->nodeLeft == NULL) ||
+//                  (treeNode->nodeRight == NULL || treeNode->nodeLeft == NULL)) )
+//     {
 //       nodeA->collidesWith(nodeB, treeNode->bvElement->center);
 //       nodeB->collidesWith(nodeA, this->bvElement->center);
-      nodeA->registerCollision(nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement);
-    }
+//       nodeA->registerCollision(nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement);
+//     }
 
   }
