Index: /branches/collision_detection/src/defs/debug.h
===================================================================
--- /branches/collision_detection/src/defs/debug.h	(revision 5712)
+++ /branches/collision_detection/src/defs/debug.h	(revision 5713)
@@ -75,5 +75,5 @@
   #define DEBUG_MODULE_OBJECT_MANAGER        2
   #define DEBUG_MODULE_ANIM                  2
-  #define DEBUG_MODULE_COLLISON_DETECTION    2
+  #define DEBUG_MODULE_COLLISON_DETECTION    5
   #define DEBUG_MODULE_SPATIAL_SEPARATION    2
   #define DEBUG_MODULE_GUI                   2
Index: /branches/collision_detection/src/lib/collision_detection/cd_engine.cc
===================================================================
--- /branches/collision_detection/src/lib/collision_detection/cd_engine.cc	(revision 5712)
+++ /branches/collision_detection/src/lib/collision_detection/cd_engine.cc	(revision 5713)
@@ -14,5 +14,5 @@
 */
 
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION_DETECTION
 
 #include "cd_engine.h"
Index: /branches/collision_detection/src/lib/collision_detection/obb_tree.cc
===================================================================
--- /branches/collision_detection/src/lib/collision_detection/obb_tree.cc	(revision 5712)
+++ /branches/collision_detection/src/lib/collision_detection/obb_tree.cc	(revision 5713)
@@ -14,5 +14,5 @@
 */
 
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION_DETECTION
 
 #include "obb_tree.h"
@@ -76,5 +76,5 @@
       this->flushTree();
     }
-  OBBTreeNode* node = new OBBTreeNode(this);
+  OBBTreeNode* node = new OBBTreeNode(*this, depth);
   this->rootNode = node;
   this->rootNode->spawnBVTree(--depth, verticesList, length);
@@ -89,12 +89,12 @@
     this->flushTree();
   }
-  OBBTreeNode* node = new OBBTreeNode(this);
+  OBBTreeNode* node = new OBBTreeNode(*this, depth);
   this->rootNode = node;
-  
+
   /* triangles indexes created */
   int* triangleIndexes = new int[modelInf.numTriangles];
   for(int i = 0; i < modelInf.numTriangles; ++i)
     triangleIndexes[i] = i;
-  
+
   this->rootNode->spawnBVTree(--depth, modelInf, triangleIndexes, modelInf.numTriangles);
 }
Index: /branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- /branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc	(revision 5712)
+++ /branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc	(revision 5713)
@@ -14,5 +14,5 @@
 */
 
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION_DETECTION
 
 #include "obb_tree_node.h"
@@ -42,12 +42,16 @@
  *  standard constructor
  */
-OBBTreeNode::OBBTreeNode (const OBBTree* tree)
+OBBTreeNode::OBBTreeNode (const OBBTree& tree, unsigned int depth)
   : BVTreeNode()
 {
   this->setClassID(CL_OBB_TREE_NODE, "OBBTreeNode");
-  this->obbTree = tree;
+
+  this->obbTree = &tree;
+  this->depth = depth;
+
   this->nodeLeft = NULL;
   this->nodeRight = NULL;
   this->bvElement = NULL;
+
   this->tmpVert1 = NULL;
   this->tmpVert2 = NULL;
@@ -75,5 +79,4 @@
     OBBTreeNode_sphereObj = gluNewQuadric();
 }
-
 
 /**
@@ -117,4 +120,5 @@
 
   PRINTF(3)("OBB Depth: %i, tree index: %i, numVertices: %i\n", depth, treeIndex, length);
+  printf("OBBTreeNode::spawnBVTree()\n");
   this->depth = depth;
 
@@ -132,5 +136,5 @@
   if( likely( this->depth > 0))
   {
-    this->forkBox(*this->bvElement);
+    //this->forkBox(*this->bvElement);
 
 
@@ -170,5 +174,5 @@
 void OBBTreeNode::spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length)
 {
-//   PRINT(3)("\n");
+//   PRINTF(3)("\n");
 //   PRINTF(3)("OBB Depth: %i, tree index: %i, numVertices: %i\n", depth, treeIndex, length);
 //   this->depth = depth;
@@ -239,13 +243,13 @@
   for( int i = 0; i < length ; ++i)
   {
-    sVec3D* a = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[i].indexToVertices[0]]);
-    p = *a;
-    p.debug();
-    //q = modelInf.pVertices[modelInf.pTriangles[i][1]];     //verticesList[i + 1];
-    //r = modelInf.pVertices[modelInf.pTriangles[i][2]];     //verticesList[i + 2];
-
+    tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[i]].indexToVertices[0]]);
+    p = *tmpVec;
+    tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[i]].indexToVertices[1]]);
+    q = *tmpVec;
+    tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[i]].indexToVertices[2]]);
+    r = *tmpVec;
+
+    /* finding the facelet surface via cross-product */
     t1 = p - q; t2 = p - r;
-
-    /* finding the facelet surface via cross-product */
     facelet[i] = 0.5f * fabs( t1.cross(t2).len() );
     /* update the entire convex hull surface */
@@ -270,7 +274,11 @@
       for( int i = 0; i + 3 < length; i+=3)
       {
-        p = verticesList[i];
-        q = verticesList[i + 1];
-        r = verticesList[i + 2];
+        tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[i]].indexToVertices[0]]);
+        p = *tmpVec;
+        tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[i]].indexToVertices[1]]);
+        q = *tmpVec;
+        tmpVec = (sVec3D*)(&modelInf.pVertices[modelInf.pTriangles[triangleIndexes[i]].indexToVertices[2]]);
+        r = *tmpVec;
+
 
         covariance[j][k] = facelet[i] / (12.0f * face) * (9.0f * centroid[i][j] * centroid[i][k] + p[j] * p[k] +
@@ -286,5 +294,5 @@
     PRINTF(3)(" Vertex[%i]: %f, %f, %f\n", i, box.vertices[i][0], box.vertices[i][1], box.vertices[i][2]);
   PRINTF(3)("\nOBB Covariance Matrix:\n");
-  for(int j = 0; j < 3; ++j) { PRINT(3)(" |"); for(int k = 0; k < 3; ++k) { PRINT(3)(" \b%f ", covariance[j][k]); } PRINT(3)(" |\n"); }
+  for(int j = 0; j < 3; ++j) { PRINTF(3)(" |"); for(int k = 0; k < 3; ++k) { PRINTF(3)(" \b%f ", covariance[j][k]); } PRINTF(3)(" |\n"); }
   PRINTF(3)("OBB Center: %f, %f, %f\n", center.x, center.y, center.z);
 
@@ -357,5 +365,5 @@
 void OBBTreeNode::calculateBoxAxis(OBB& box, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length)
 {
-  this->calculateBoxAxis(box, (const sVec3D*)modInfo.pVertices, modInfo.numVertices);
+  //this->calculateBoxAxis(box, (const sVec3D*)modInfo.pVertices, modInfo.numVertices);
 }
 
@@ -597,5 +605,5 @@
   PRINTF(3)("collideWith\n");
   /* if the obb overlap, make subtests: check which node is realy overlaping  */
-  PRINT(3)("Checking OBB %i vs %i: ", this->getIndex(), treeNode->getIndex());
+  PRINTF(3)("Checking OBB %i vs %i: ", this->getIndex(), treeNode->getIndex());
   if( unlikely(treeNode == NULL)) return;
 
@@ -607,5 +615,5 @@
     if( likely( this->nodeLeft != NULL))
     {
-      PRINT(3)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex());
+      PRINTF(3)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex());
       if( this->overlapTest(this->nodeLeft->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB))
       {
@@ -617,5 +625,5 @@
     if( likely( this->nodeRight != NULL))
     {
-      PRINT(3)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex());
+      PRINTF(3)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex());
       if(this->overlapTest(this->nodeRight->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB))
       {
@@ -691,5 +699,5 @@
     if( (rA + rB) < fabs(t.dot(l)))
     {
-      PRINT(3)("no Collision\n");
+      PRINTF(3)("no Collision\n");
       return false;
     }
@@ -715,5 +723,5 @@
     if( (rA + rB) < fabs(t.dot(l)))
     {
-      PRINT(3)("no Collision\n");
+      PRINTF(3)("no Collision\n");
       return false;
     }
@@ -743,5 +751,5 @@
       if( (rA + rB) < fabs(t.dot(l)))
       {
-        PRINT(3)("keine Kollision\n");
+        PRINTF(3)("keine Kollision\n");
         return false;
       }
@@ -752,5 +760,5 @@
   boxA->bCollided = true; /* use this ONLY(!!!!) for drawing operations */
   boxB->bCollided = true;
-  PRINT(3)("Kollision!\n");
+  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 5712)
+++ /branches/collision_detection/src/lib/collision_detection/obb_tree_node.h	(revision 5713)
@@ -25,6 +25,5 @@
 
   public:
-    OBBTreeNode(const OBBTree* tree);
-    OBBTreeNode(const OBBTree* tree, bool bRoot);
+    OBBTreeNode(const OBBTree& tree, unsigned int depth);
     virtual ~OBBTreeNode();
 
Index: /branches/collision_detection/src/world_entities/world_entity.cc
===================================================================
--- /branches/collision_detection/src/world_entities/world_entity.cc	(revision 5712)
+++ /branches/collision_detection/src/world_entities/world_entity.cc	(revision 5713)
@@ -119,7 +119,8 @@
   {
     PRINTF(4)("creating obb tree\n");
-    
-    
-    this->obbTree = new OBBTree(depth, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
+
+
+    //this->obbTree = new OBBTree(depth, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
+    this->obbTree = new OBBTree(depth, *model->getModelInfo());
     return true;
   }
