Index: branches/collision_detection/src/lib/collision_detection/bv_tree.h
===================================================================
--- branches/collision_detection/src/lib/collision_detection/bv_tree.h	(revision 5717)
+++ branches/collision_detection/src/lib/collision_detection/bv_tree.h	(revision 5718)
@@ -43,6 +43,5 @@
   virtual void flushTree() = 0;
 
-  virtual void collideWith(BVTree* tree, WorldEntity* nodeA, WorldEntity* nodeB) = 0;
-  virtual void collideWith(WorldEntity* entity1, WorldEntity* entity2) = 0;
+  virtual void collideWith(const WorldEntity& entity1, const WorldEntity& entity2) const = 0;
 
   /** @param depth: depth, @param drawMode: how to draw the Model */
Index: branches/collision_detection/src/lib/collision_detection/bv_tree_node.h
===================================================================
--- branches/collision_detection/src/lib/collision_detection/bv_tree_node.h	(revision 5717)
+++ branches/collision_detection/src/lib/collision_detection/bv_tree_node.h	(revision 5718)
@@ -19,6 +19,8 @@
 template<class T> class tList;
 
+
 //! A class that represents a bounding volume tree
 class BVTreeNode : public BaseObject {
+
 
  public:
Index: branches/collision_detection/src/lib/collision_detection/cd_engine.cc
===================================================================
--- branches/collision_detection/src/lib/collision_detection/cd_engine.cc	(revision 5717)
+++ branches/collision_detection/src/lib/collision_detection/cd_engine.cc	(revision 5718)
@@ -94,5 +94,5 @@
         if( likely(entity2 != this->terrain))
         {
-          printf("checking object %s against %s\n", entity1->getName(), entity2->getName());
+          //printf("checking object %s against %s\n", entity1->getName(), entity2->getName());
           tree = entity1->getOBBTree();
 
Index: branches/collision_detection/src/lib/collision_detection/obb_tree.cc
===================================================================
--- branches/collision_detection/src/lib/collision_detection/obb_tree.cc	(revision 5717)
+++ branches/collision_detection/src/lib/collision_detection/obb_tree.cc	(revision 5718)
@@ -104,21 +104,15 @@
 
 
-void OBBTree::collideWith(WorldEntity* entity1, WorldEntity* entity2)
-{
-  if( likely(entity2->getOBBTree() != NULL) )
-    this->rootNode->collideWith(((OBBTree*)entity2->getOBBTree())->getRootNode(), entity1, entity2);
-}
-
-
 /**
  * this collides two bvtrees together. the trees are attached to pnodes Objects A and B
- * @param tree: the other tree to collide with (Object B)
  * @param nodeA: PNode of object A
  * @param nodeB: Pnode of object B
  */
-void OBBTree::collideWith(BVTree* tree, WorldEntity* nodeA, WorldEntity* nodeB)
+void OBBTree::collideWith(const WorldEntity& entity1, const WorldEntity& entity2) const
 {
-  this->rootNode->collideWith(((OBBTree*)tree)->getRootNode(), nodeA, nodeB);
+  if( likely(entity2.getOBBTree() != NULL) )
+    this->rootNode->collideWith(*(((OBBTree*)entity2.getOBBTree())->getRootNode()), entity1, entity2);
 }
+
 
 
Index: branches/collision_detection/src/lib/collision_detection/obb_tree.h
===================================================================
--- branches/collision_detection/src/lib/collision_detection/obb_tree.h	(revision 5717)
+++ branches/collision_detection/src/lib/collision_detection/obb_tree.h	(revision 5718)
@@ -29,6 +29,5 @@
     virtual void flushTree();
 
-    virtual void collideWith(BVTree* tree, WorldEntity* nodeA, WorldEntity* nodeB);
-    virtual void collideWith(WorldEntity* entity1, WorldEntity* entity2);
+    virtual void collideWith(const WorldEntity& entity1, const WorldEntity& entity2) const;
 
     virtual void drawBV(int depth, int drawMode) const;
Index: branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc	(revision 5717)
+++ branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc	(revision 5718)
@@ -600,23 +600,24 @@
 
 
-void OBBTreeNode::collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB) const
+void OBBTreeNode::collideWith(const BVTreeNode& treeNode, const WorldEntity& nodeA, const WorldEntity& nodeB) const
 {
   PRINTF(3)("collideWith\n");
   /* if the obb overlap, make subtests: check which node is realy overlaping  */
-  PRINTF(3)("Checking OBB %i vs %i: ", this->getIndex(), treeNode->getIndex());
-  if( unlikely(treeNode == NULL)) return;
-
-  if( this->overlapTest(this->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB))
-  {
-    PRINTF(3)("collision @ lvl %i, object %s vs. %s, (%p, %p)\n", this->depth, nodeA->getClassName(), nodeB->getClassName(), this->nodeLeft, this->nodeRight);
+  PRINTF(3)("Checking OBB %i vs %i: ", this->getIndex(), treeNode.getIndex());
+//   if( unlikely(treeNode == NULL)) return;
+
+
+  if( this->overlapTest(*this->bvElement, *(((const OBBTreeNode*)&treeNode)->bvElement), nodeA, nodeB))
+  {
+    PRINTF(3)("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 */
     if( likely( this->nodeLeft != NULL))
     {
-      PRINTF(3)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex());
-      if( this->overlapTest(this->nodeLeft->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB))
+      PRINTF(3)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode.getIndex());
+      if( this->overlapTest(*this->nodeLeft->bvElement, *(((const OBBTreeNode*)&treeNode)->bvElement), nodeA, nodeB))
       {
-        this->nodeLeft->collideWith(((OBBTreeNode*)treeNode)->nodeLeft, nodeA, nodeB);
-        this->nodeLeft->collideWith(((OBBTreeNode*)treeNode)->nodeRight, nodeA, nodeB);
+        this->nodeLeft->collideWith(*(((const OBBTreeNode*)&treeNode)->nodeLeft), nodeA, nodeB);
+        this->nodeLeft->collideWith(*(((const OBBTreeNode*)&treeNode)->nodeRight), nodeA, nodeB);
       }
     }
@@ -624,29 +625,30 @@
     if( likely( this->nodeRight != NULL))
     {
-      PRINTF(3)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex());
-      if(this->overlapTest(this->nodeRight->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB))
+      PRINTF(3)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode.getIndex());
+      if(this->overlapTest(*this->nodeRight->bvElement, *(((const OBBTreeNode*)&treeNode)->bvElement), nodeA, nodeB))
       {
-       this->nodeRight->collideWith(((OBBTreeNode*)treeNode)->nodeLeft, nodeA, nodeB);
-       this->nodeRight->collideWith(((OBBTreeNode*)treeNode)->nodeRight, nodeA, nodeB);
+        this->nodeRight->collideWith(*(((const OBBTreeNode*)&treeNode)->nodeLeft), nodeA, nodeB);
+        this->nodeRight->collideWith(*(((const OBBTreeNode*)&treeNode)->nodeRight), nodeA, nodeB);
       }
     }
 
     /* so there is a collision and this is the last box in the tree (i.e. leaf) */
+    /* FIXME: If we would choose || insead of && there would also be asymmetrical cases supported */
     if( unlikely(this->nodeRight == NULL && this->nodeLeft == NULL))
     {
-      nodeA->collidesWith(nodeB, ((OBBTreeNode*)treeNode)->bvElement->center);
-
-      nodeB->collidesWith(nodeA, this->bvElement->center);
-    }
-
-  }
-}
-
-
-
-bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB) const
-{
-  if( boxB == NULL || boxA == NULL)
-    return false;
+      nodeA.collidesWith(nodeB, (((const OBBTreeNode*)&treeNode)->bvElement->center));
+
+      nodeB.collidesWith(nodeA, this->bvElement->center);
+    }
+
+  }
+}
+
+
+
+bool OBBTreeNode::overlapTest(const OBB& boxA, const OBB& boxB, const WorldEntity& nodeA, const WorldEntity& nodeB) const
+{
+//   if( boxB == NULL || boxA == NULL)
+//     return false;
 
   /* first check all axis */
@@ -658,14 +660,14 @@
   Vector rotAxisB[3];
 
-  rotAxisA[0] =  nodeA->getAbsDir().apply(boxA->axis[0]);
-  rotAxisA[1] =  nodeA->getAbsDir().apply(boxA->axis[1]);
-  rotAxisA[2] =  nodeA->getAbsDir().apply(boxA->axis[2]);
-
-  rotAxisB[0] =  nodeB->getAbsDir().apply(boxB->axis[0]);
-  rotAxisB[1] =  nodeB->getAbsDir().apply(boxB->axis[1]);
-  rotAxisB[2] =  nodeB->getAbsDir().apply(boxB->axis[2]);
-
-
-  t = nodeA->getAbsCoor() + nodeA->getAbsDir().apply(boxA->center) - ( nodeB->getAbsCoor() + nodeB->getAbsDir().apply(boxB->center));
+  rotAxisA[0] =  nodeA.getAbsDir().apply(boxA.axis[0]);
+  rotAxisA[1] =  nodeA.getAbsDir().apply(boxA.axis[1]);
+  rotAxisA[2] =  nodeA.getAbsDir().apply(boxA.axis[2]);
+
+  rotAxisB[0] =  nodeB.getAbsDir().apply(boxB.axis[0]);
+  rotAxisB[1] =  nodeB.getAbsDir().apply(boxB.axis[1]);
+  rotAxisB[2] =  nodeB.getAbsDir().apply(boxB.axis[2]);
+
+
+  t = nodeA.getAbsCoor() + nodeA.getAbsDir().apply(boxA.center) - ( nodeB.getAbsCoor() + nodeB.getAbsDir().apply(boxB.center));
 
 //   printf("\n");
@@ -686,11 +688,11 @@
     l = rotAxisA[j];
 
-    rA += fabs(boxA->halfLength[0] * rotAxisA[0].dot(l));
-    rA += fabs(boxA->halfLength[1] * rotAxisA[1].dot(l));
-    rA += fabs(boxA->halfLength[2] * rotAxisA[2].dot(l));
-
-    rB += fabs(boxB->halfLength[0] * rotAxisB[0].dot(l));
-    rB += fabs(boxB->halfLength[1] * rotAxisB[1].dot(l));
-    rB += fabs(boxB->halfLength[2] * rotAxisB[2].dot(l));
+    rA += fabs(boxA.halfLength[0] * rotAxisA[0].dot(l));
+    rA += fabs(boxA.halfLength[1] * rotAxisA[1].dot(l));
+    rA += fabs(boxA.halfLength[2] * rotAxisA[2].dot(l));
+
+    rB += fabs(boxB.halfLength[0] * rotAxisB[0].dot(l));
+    rB += fabs(boxB.halfLength[1] * rotAxisB[1].dot(l));
+    rB += fabs(boxB.halfLength[2] * rotAxisB[2].dot(l));
 
     PRINTF(3)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB);
@@ -710,11 +712,11 @@
     l = rotAxisB[j];
 
-    rA += fabs(boxA->halfLength[0] * rotAxisA[0].dot(l));
-    rA += fabs(boxA->halfLength[1] * rotAxisA[1].dot(l));
-    rA += fabs(boxA->halfLength[2] * rotAxisA[2].dot(l));
-
-    rB += fabs(boxB->halfLength[0] * rotAxisB[0].dot(l));
-    rB += fabs(boxB->halfLength[1] * rotAxisB[1].dot(l));
-    rB += fabs(boxB->halfLength[2] * rotAxisB[2].dot(l));
+    rA += fabs(boxA.halfLength[0] * rotAxisA[0].dot(l));
+    rA += fabs(boxA.halfLength[1] * rotAxisA[1].dot(l));
+    rA += fabs(boxA.halfLength[2] * rotAxisA[2].dot(l));
+
+    rB += fabs(boxB.halfLength[0] * rotAxisB[0].dot(l));
+    rB += fabs(boxB.halfLength[1] * rotAxisB[1].dot(l));
+    rB += fabs(boxB.halfLength[2] * rotAxisB[2].dot(l));
 
     PRINTF(3)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB);
@@ -738,11 +740,11 @@
       l = rotAxisA[j].cross(rotAxisB[k]);
 
-      rA += fabs(boxA->halfLength[0] * rotAxisA[0].dot(l));
-      rA += fabs(boxA->halfLength[1] * rotAxisA[1].dot(l));
-      rA += fabs(boxA->halfLength[2] * rotAxisA[2].dot(l));
-
-      rB += fabs(boxB->halfLength[0] * rotAxisB[0].dot(l));
-      rB += fabs(boxB->halfLength[1] * rotAxisB[1].dot(l));
-      rB += fabs(boxB->halfLength[2] * rotAxisB[2].dot(l));
+      rA += fabs(boxA.halfLength[0] * rotAxisA[0].dot(l));
+      rA += fabs(boxA.halfLength[1] * rotAxisA[1].dot(l));
+      rA += fabs(boxA.halfLength[2] * rotAxisA[2].dot(l));
+
+      rB += fabs(boxB.halfLength[0] * rotAxisB[0].dot(l));
+      rB += fabs(boxB.halfLength[1] * rotAxisB[1].dot(l));
+      rB += fabs(boxB.halfLength[2] * rotAxisB[2].dot(l));
 
       PRINTF(3)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB);
@@ -756,7 +758,9 @@
   }
 
-
-  boxA->bCollided = true; /* use this ONLY(!!!!) for drawing operations */
-  boxB->bCollided = true;
+  /* FIXME: there is no collision mark set now */
+//   boxA.bCollided = true; /* use this ONLY(!!!!) for drawing operations */
+//   boxB.bCollided = true;
+
+
   PRINTF(3)("Kollision!\n");
   return true;
Index: branches/collision_detection/src/lib/collision_detection/obb_tree_node.h
===================================================================
--- branches/collision_detection/src/lib/collision_detection/obb_tree_node.h	(revision 5717)
+++ branches/collision_detection/src/lib/collision_detection/obb_tree_node.h	(revision 5718)
@@ -34,5 +34,5 @@
     virtual void spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, unsigned int length);
 
-    virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB) const;
+    virtual void collideWith(const BVTreeNode& treeNode, const WorldEntity& nodeA, const WorldEntity& nodeB) const;
     virtual void drawBV(int depth, int drawMode, const Vector& color = Vector(1,0,0), bool top = true) const;
     void debug() const;
@@ -48,5 +48,5 @@
     void forkBox(OBB& box);
 
-    bool overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB) const;
+    bool overlapTest(const OBB& boxA, const OBB& boxB, const WorldEntity& nodeA, const WorldEntity& nodeB) const;
 
 
