Index: orxonox/trunk/src/lib/collision_detection/cd_engine.cc
===================================================================
--- orxonox/trunk/src/lib/collision_detection/cd_engine.cc	(revision 4709)
+++ orxonox/trunk/src/lib/collision_detection/cd_engine.cc	(revision 4710)
@@ -130,2 +130,8 @@
   this->rootTree->spawnBVTree(depth, vertices, numVertices);
 }
+
+void CDEngine::debugDraw(int depth, int drawMode)
+{
+  if(this-> rootTree != NULL)
+    this->rootTree->drawBV(depth, drawMode);
+}
Index: orxonox/trunk/src/lib/collision_detection/cd_engine.h
===================================================================
--- orxonox/trunk/src/lib/collision_detection/cd_engine.h	(revision 4709)
+++ orxonox/trunk/src/lib/collision_detection/cd_engine.h	(revision 4710)
@@ -52,4 +52,5 @@
   void debug();
   void debugSpawnTree(int depth, sVec3D* vertices, int numVertices);
+  void debugDraw(int depth, int drawMode);
 
  private:
Index: orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 4709)
+++ orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 4710)
@@ -114,5 +114,5 @@
 
 
-    if(this->tmpLen1 > 0)
+    if(this->tmpLen1 > 2)
     {
       OBBTreeNode* node1 = new OBBTreeNode();
@@ -125,5 +125,5 @@
     }
 
-    if( this->tmpLen2 > 0)
+    if( this->tmpLen2 > 2)
     {
       OBBTreeNode* node2 = new OBBTreeNode();
@@ -133,5 +133,5 @@
     else
     {
-      PRINTF(0)("Aboarding tree walk: less than 3 vertices left\n");
+      PRINTF(0)("Abording tree walk: less than 3 vertices left\n");
     }
 
@@ -420,6 +420,6 @@
 
   /* get the maximal dimensions of the body in all directions */
-   maxLength[0] = 0.0f;
-   minLength[0] = 0.0f;
+    maxLength[0] = p0.distancePoint(vertices[0]);
+    minLength[0] = p0.distancePoint(vertices[0]);
    for(int j = 0; j < length; ++j)
    {
@@ -431,6 +431,6 @@
    }
 
-   maxLength[1] = 0.0f;
-   minLength[1] = 0.0f;
+   maxLength[1] = p1.distancePoint(vertices[0]);
+   minLength[1] = p1.distancePoint(vertices[0]);
    for(int j = 0; j < length; ++j)
    {
@@ -442,6 +442,6 @@
    }
 
-   maxLength[2] = 0.0f;
-   minLength[2] = 0.0f;
+   maxLength[2] = p2.distancePoint(vertices[0]);
+   minLength[2] = p2.distancePoint(vertices[0]);
    for(int j = 0; j < length; ++j)
    {
@@ -460,6 +460,6 @@
      {
        PRINTF(3)("max: %f, min: %f \n", maxLength[i], minLength[i]);
-       centerOffset[i] = (maxLength[i] + minLength[i]) / 2.0f; // min length is negatie
-       newHalfLength[i] = (maxLength[i] - minLength[i]) / 2.0f; // min length is negative
+       centerOffset[i] = (maxLength[i] + minLength[i]) / 2.0f;       // min length is negatie
+       newHalfLength[i] = (maxLength[i] - minLength[i]) / 2.0f;      // min length is negative
        *box->center +=  (box->axis[i] * centerOffset[i]);            // update the new center vector
        halfLength[i] = newHalfLength[i];
@@ -478,5 +478,14 @@
   {
     //if( box->halfLength[i] == 0.0)
-    PRINTF(3)("length[%i] = %f\n", i, box->halfLength[i]);
+    if(fabs(box->halfLength[i]) > 5.0f)
+    {
+      PRINTF(0)("length[%i] = %f\n", i, box->halfLength[i]);
+      PRINTF(0)("MaxLength = %f, MinLength = %f\n", maxLength[i], minLength[i]);
+      PRINTF(0)("\nVertex Data:\n");
+      for(int i = 0; i < length; i++)
+      {
+        PRINTF(0)("vertex %i: %f, %f, %f\n", i, box->vertices[i][0], box->vertices[i][1], box->vertices[i][2]);
+      }
+    }
   }
 }
@@ -525,5 +534,5 @@
   }
 
-//   PRINTF(3)("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist);
+  PRINTF(3)("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist);
 
 
@@ -534,4 +543,5 @@
   tList<sVec3D>      partition2;                           //!< the vertex partition 2
 
+
   PRINTF(3)("vertex index: %i, of %i\n", vertexIndex, box->numOfVertices);
   this->separationPlane = new Plane(box->axis[axisIndex], box->vertices[vertexIndex]);  //!< separation plane
@@ -541,12 +551,15 @@
   for(int i = 0; i < box->numOfVertices; ++i)
   {
-    if( this->separationPlane->distancePoint(box->vertices[i]) > 0.0f)
-      partition1.add(&box->vertices[i]);
+    if( i == vertexIndex) continue;
+    tmpDist = this->separationPlane->distancePoint(box->vertices[i]);
+    if( tmpDist > 0.0)
+      partition1.add(&box->vertices[i]); /* positive numbers plus zero */
     else
-      partition2.add(&box->vertices[i]);
+      partition2.add(&box->vertices[i]); /* negatice numbers */
   }
   partition1.add(&box->vertices[vertexIndex]);
-
-//   PRINTF(3)("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize());
+  partition2.add(&box->vertices[vertexIndex]);
+
+  PRINTF(3)("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize());
 
 
@@ -827,4 +840,6 @@
   if( drawMode & DRAW_BV_POLYGON || drawMode & DRAW_ALL || drawMode & DRAW_BV_BLENDED)
   {
+    if(this->nodeLeft == NULL && this->nodeRight == NULL)
+      depth = 0;
     if( !(drawMode & DRAW_SINGLE && depth != 0))
     {
Index: orxonox/trunk/src/subprojects/collision_detection/Makefile.am
===================================================================
--- orxonox/trunk/src/subprojects/collision_detection/Makefile.am	(revision 4709)
+++ orxonox/trunk/src/subprojects/collision_detection/Makefile.am	(revision 4710)
@@ -41,4 +41,5 @@
                    $(MAINSRCDIR)/world_entities/world_entity.cc
 
+#$(MAINSRCDIR)/util/loading/load_param.cc
 
 
Index: orxonox/trunk/src/subprojects/collision_detection/Makefile.in
===================================================================
--- orxonox/trunk/src/subprojects/collision_detection/Makefile.in	(revision 4709)
+++ orxonox/trunk/src/subprojects/collision_detection/Makefile.in	(revision 4710)
@@ -878,4 +878,6 @@
 include $(MAINSRCDIR)/defs/include_paths.am
 
+#$(MAINSRCDIR)/util/loading/load_param.cc
+
 #                   $(MAINSRCDIR)/util/loading/game_loader.cc \
 #                   $(MAINSRCDIR)/util/track/track_manager.cc \
Index: orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc
===================================================================
--- orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc	(revision 4709)
+++ orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc	(revision 4710)
@@ -29,4 +29,5 @@
 #include "test_entity.h"
 #include "environment.h"
+
 
 #include "graphics_engine.h"
@@ -44,6 +45,7 @@
 bool drawModel;
 
-Environment* a;
-Environment* b;
+WorldEntity* a;
+WorldEntity* b;
+//Terrain* c;
 
 void Framework::moduleInit(int argc, char** argv)
@@ -53,6 +55,14 @@
   CDEngine::getInstance();
 
-  /* Simple Test */
-  //CDEngine::getInstance()->debug();
+  /* Primitive Data Test */
+//   sVec3D* data = new sVec3D[6];
+//   float tmp[6][3] = {{0.0, 4.2, 2.4}, {3.0, 3.0, 2.0}, {5.0, 1.0, 6.0}, {6.5, 1.0, 3.0}, {7.0, 3.0, 5.0}, {8.0, 6.0, 6.0}};
+//   for(int i = 0; i < 6; ++i)
+//   {
+//     data[i][0] = tmp[i][0];
+//     data[i][1] = tmp[i][1];
+//     data[i][2] = tmp[i][2];
+//   }
+//   CDEngine::getInstance()->debugSpawnTree(5, data, 6);
 
   /* MD2 Model Test */
@@ -69,13 +79,11 @@
   entityList = new tList<WorldEntity>();
 
-  //a = new TestEntity(); a->setName("Clown1");
-  a = new Environment(); a->setName("Clown");
-  b = new Environment(); b->setName("Jaeger");
+  a = new TestEntity(); a->setName("Clown1");
+  b = new Environment(); a->setName("Clown");
+  //b = new Environment(); b->setName("Jaeger");
+  //c = new Terrain();
 
   b->setRelCoor(0.0, 0.0, -10.0);
-  b->setRelDir(Quaternion(-M_PI/2.0f, Vector(0.0, 1.0, 0.0)));
-
-//   TestEntity* c = new TestEntity(); c->setName("Colwn2");
-//   c->setRelCoor(0.0, 0.0, -20.0);
+  //b->setRelDir(Quaternion(-M_PI/2.0f, Vector(0.0, 1.0, 0.0)));
 
   entityList->add(a);
@@ -85,9 +93,10 @@
 
   LightManager* lightMan = LightManager::getInstance();
-  lightMan->setAmbientColor(.1,.1,.1);
+    lightMan->setAmbientColor(.1,.1,.1);
   lightMan->addLight();
-  lightMan->setPosition(30, 30, 30);
+  lightMan->setPosition(-5.0, 50.0, -40.0);
   lightMan->addLight();
-  lightMan->setPosition(-30, -30, -30);
+  lightMan->setPosition(100, 80, 60);
+
 
   /* properties */
@@ -223,5 +232,5 @@
 
 
-  b->shiftCoor(Vector(0.0, 0.0, iterata));
+  //b->shiftCoor(Vector(0.0, 0.0, iterata));
 
 
@@ -239,4 +248,6 @@
 void Framework::moduleDraw() const
 {
+  //CDEngine::getInstance()->debugDraw(depth, drawMode);
+
   tIterator<WorldEntity>* iterator = entityList->getIterator();
   WorldEntity* entity = iterator->nextElement();
@@ -371,5 +382,5 @@
 
 
-      Slider* TreeDepth = new Slider("TreeDepth", 0, 5);
+      Slider* TreeDepth = new Slider("TreeDepth", 0, 10);
       TreeDepth->connectSignal("value_changed", (void*)TreeDepth, treeDepth);
       windowBox->fill(TreeDepth);
Index: orxonox/trunk/src/world_entities/environment.cc
===================================================================
--- orxonox/trunk/src/world_entities/environment.cc	(revision 4709)
+++ orxonox/trunk/src/world_entities/environment.cc	(revision 4710)
@@ -33,7 +33,7 @@
 {
   this->setClassID(CL_ENVIRONMENT, "Environment");
-  this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
+  this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj"/*"worlds/vulcania.obj"*/, OBJ, RP_CAMPAIGN);
 
-  this->obbTree = new OBBTree(4, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
+  this->obbTree = new OBBTree(10, (sVec3D*)this->model->getVertexArray(), this->model->getVertexCount());
 }
 
