Index: /orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- /orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 4635)
+++ /orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 4636)
@@ -475,5 +475,5 @@
   if( drawMode & DRAW_BV_AXIS || drawMode & DRAW_ALL)
   {
-    if( drawMode & DRAW_SINGLE && depth == 0)
+    if( !(drawMode & DRAW_SINGLE && depth != 0))
     {
       /* draw the obb axes */
@@ -501,90 +501,91 @@
   if( drawMode & DRAW_BV_POLYGON || drawMode & DRAW_ALL)
   {
-    if( drawMode & DRAW_SINGLE && depth == 0)
+    if( !(drawMode & DRAW_SINGLE && depth != 0))
     {
-      Vector cen = *this->bvElement->center;
-      Vector** axis = this->bvElement->axis;
-      float* len = this->bvElement->halfLength;
-
-      /* draw bounding box */
-      glBegin(GL_LINE_LOOP);
-      glColor3f(0.3, 0.4, 0.7);
-      glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
-                 cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
-                 cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
-      glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
-                 cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
-                 cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
-      glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
-                 cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
-                 cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
-      glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
-                 cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
-                 cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
-      glEnd();
-
-      glBegin(GL_LINE_LOOP);
-      glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
-                 cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
-                 cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
-      glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
-                 cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
-                 cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
-      glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
-                 cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
-                 cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
-      glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
-                 cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
-                 cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
-      glEnd();
-
-      glBegin(GL_LINE_LOOP);
-      glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
-                 cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
-                 cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
-      glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
-                 cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
-                 cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
-      glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
-                 cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
-                 cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
-      glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
-                 cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
-                 cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
-      glEnd();
-
-      glBegin(GL_LINE_LOOP);
-      glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
-                 cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
-                 cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
-      glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
-                 cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
-                 cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
-      glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
-                 cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
-                 cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
-      glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
-                 cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
-                 cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
-      glEnd();
+    Vector cen = *this->bvElement->center;
+    Vector** axis = this->bvElement->axis;
+    float* len = this->bvElement->halfLength;
+
+    /* draw bounding box */
+    glBegin(GL_LINE_LOOP);
+    glColor3f(0.3, 0.4, 0.7);
+    glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
+               cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
+               cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
+    glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
+               cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
+               cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
+    glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
+               cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
+               cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
+    glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
+               cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
+               cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
+    glEnd();
+
+    glBegin(GL_LINE_LOOP);
+    glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
+               cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
+               cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
+    glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
+               cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
+               cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
+    glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
+               cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
+               cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
+    glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
+               cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
+               cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
+    glEnd();
+
+    glBegin(GL_LINE_LOOP);
+    glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
+               cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
+               cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
+    glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
+               cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
+               cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
+    glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
+               cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
+               cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
+    glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
+               cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
+               cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
+    glEnd();
+
+    glBegin(GL_LINE_LOOP);
+    glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
+               cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
+               cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
+    glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
+               cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
+               cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
+    glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
+               cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
+               cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
+    glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
+               cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
+               cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
+    glEnd();
     }
+
   }
 
   if( drawMode & DRAW_SEPARATING_PLANE || drawMode & DRAW_ALL)
   {
-    if( drawMode & DRAW_SINGLE && depth == 0)
+    if( !(drawMode & DRAW_SINGLE && depth != 0))
     {
-      /* now draw the separation plane */
-      Vector a1 = *this->bvElement->axis[(this->longestAxisIndex + 1)%3];
-      Vector a2 = *this->bvElement->axis[(this->longestAxisIndex + 2)%3];
-      Vector c = *this->bvElement->center;
-      float l1 = this->bvElement->halfLength[(this->longestAxisIndex + 1)%3];
-      float l2 = this->bvElement->halfLength[(this->longestAxisIndex + 2)%3];
-      glBegin(GL_QUADS);
-      glVertex3f(c.x + a1.x * l1 + a2.x * l2, c.y + a1.y * l1+ a2.y * l2, c.z + a1.z * l1 + a2.z * l2);
-      glVertex3f(c.x - a1.x * l1 + a2.x * l2, c.y - a1.y * l1+ a2.y * l2, c.z - a1.z * l1 + a2.z * l2);
-      glVertex3f(c.x - a1.x * l1 - a2.x * l2, c.y - a1.y * l1- a2.y * l2, c.z - a1.z * l1 - a2.z * l2);
-      glVertex3f(c.x + a1.x * l1 - a2.x * l2, c.y + a1.y * l1- a2.y * l2, c.z + a1.z * l1 - a2.z * l2);
-      glEnd();
+    /* now draw the separation plane */
+    Vector a1 = *this->bvElement->axis[(this->longestAxisIndex + 1)%3];
+    Vector a2 = *this->bvElement->axis[(this->longestAxisIndex + 2)%3];
+    Vector c = *this->bvElement->center;
+    float l1 = this->bvElement->halfLength[(this->longestAxisIndex + 1)%3];
+    float l2 = this->bvElement->halfLength[(this->longestAxisIndex + 2)%3];
+    glBegin(GL_QUADS);
+    glVertex3f(c.x + a1.x * l1 + a2.x * l2, c.y + a1.y * l1+ a2.y * l2, c.z + a1.z * l1 + a2.z * l2);
+    glVertex3f(c.x - a1.x * l1 + a2.x * l2, c.y - a1.y * l1+ a2.y * l2, c.z - a1.z * l1 + a2.z * l2);
+    glVertex3f(c.x - a1.x * l1 - a2.x * l2, c.y - a1.y * l1- a2.y * l2, c.z - a1.z * l1 - a2.z * l2);
+    glVertex3f(c.x + a1.x * l1 - a2.x * l2, c.y + a1.y * l1- a2.y * l2, c.z + a1.z * l1 - a2.z * l2);
+    glEnd();
     }
   }
Index: /orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc
===================================================================
--- /orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc	(revision 4635)
+++ /orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc	(revision 4636)
@@ -27,5 +27,10 @@
 #include "md2Model.h"
 
+
+
+
 MD2Model* model;
+int drawMode;
+int depth;
 
 void Framework::moduleInit(int argc, char** argv)
@@ -48,5 +53,5 @@
 //   }
 
-  CDEngine::getInstance()->debugSpawnTree(3, model->data->pVertices, model->data->numVertices);
+  CDEngine::getInstance()->debugSpawnTree(7, model->data->pVertices, model->data->numVertices);
 
 
@@ -56,4 +61,20 @@
   lightMan->addLight();
   lightMan->setPosition(10, 20, 100);
+
+  drawMode = DRAW_MODEL;
+  depth = 2;
+
+  printf("\n\n===========================");
+  printf("Collision Detection Modler:\n");
+  printf("Key Bindings:\n");
+  printf(" -| Displaying Polygons\t\t p\n");
+  printf(" -| Displaying Separation Plane\t s\n");
+  printf("\n");
+  printf(" -| Tree Depth 1\t\t 1\n");
+  printf(" -| Tree Depth 2\t\t 2\n");
+  printf(" -| Tree Depth 3\t\t 3\n");
+  printf(" -| Tree Depth 4\t\t 4\n");
+  printf(" -| Tree Depth 5\t\t 5\n");
+  printf("===========================\n\n");
 }
 
@@ -66,9 +87,89 @@
       switch (event->key.keysym.sym)
       {
-        case SDLK_i:
+        case SDLK_a:
+          drawMode |= DRAW_ALL;
           break;
         case SDLK_1:
-          printf("alsjdf;lajsfd;lajsdf\n");
-          break;
+        {
+          printf("Setting tree depth = 1\n");
+          depth = 1;
+          int temp = drawMode & DRAW_ALL;
+          drawMode ^= temp;
+          drawMode |= DRAW_SINGLE;
+          break;
+        }
+        case SDLK_2:
+        {
+          printf("Setting tree depth = 2\n");
+          depth = 2;
+          int temp = drawMode & DRAW_ALL;
+          drawMode ^= temp;
+          drawMode |= DRAW_SINGLE;
+          break;
+        }
+        case SDLK_3:
+        {
+          printf("Setting tree depth = 3\n");
+          depth = 3;
+          int temp = drawMode & DRAW_ALL;
+          drawMode ^= temp;
+          drawMode |= DRAW_SINGLE;
+          break;
+        }
+        case SDLK_4:
+        {
+          printf("Setting tree depth = 4\n");
+          depth = 4;
+          int temp = drawMode & DRAW_ALL;
+          drawMode ^= temp;
+          drawMode |= DRAW_SINGLE;
+          break;
+        }
+        case SDLK_5:
+        {
+          printf("Setting tree depth = 5\n");
+          depth = 5;
+          int temp = drawMode & DRAW_ALL;
+          drawMode ^= temp;
+          drawMode |= DRAW_SINGLE;
+          break;
+        }
+        case SDLK_6:
+        {
+          printf("Setting tree depth = 6\n");
+          depth = 6;
+          int temp = drawMode & DRAW_ALL;
+          drawMode ^= temp;
+          drawMode |= DRAW_SINGLE;
+          break;
+        }
+        case SDLK_s:
+          if(drawMode & DRAW_SEPARATING_PLANE)
+          {
+            int temp = drawMode & DRAW_SEPARATING_PLANE;
+            drawMode ^= temp;
+            printf("Removing Separation Plane\n");
+          }
+          else
+          {
+            drawMode |= DRAW_SEPARATING_PLANE;
+            printf("Drawing Separation Plane\n");
+          }
+
+          break;
+        case SDLK_p:
+          if(drawMode & DRAW_BV_POLYGON)
+          {
+            int temp = drawMode & DRAW_BV_POLYGON;
+            drawMode ^= temp;
+            printf("Removing OBB Polygons\n");
+          }
+          else
+          {
+            drawMode |= DRAW_BV_POLYGON;
+            printf("Drawing OBB Polygons\n");
+          }
+          break;
+
       }
   }
@@ -83,5 +184,5 @@
 void Framework::moduleDraw() const
 {
-  CDEngine::getInstance()->drawBV(2, DRAW_MODEL);
+  CDEngine::getInstance()->drawBV(depth, drawMode);
 
   LightManager::getInstance()->draw();
Index: /orxonox/trunk/src/subprojects/framework.cc
===================================================================
--- /orxonox/trunk/src/subprojects/framework.cc	(revision 4635)
+++ /orxonox/trunk/src/subprojects/framework.cc	(revision 4636)
@@ -171,5 +171,5 @@
 #endif
             break;
-          case SDLK_a:
+          case SDLK_t:
             camera->setRelCoor(camera->getRelCoor() + (camera->getTarget()->getAbsCoor() - camera->getAbsCoor())*.1);
             break;
@@ -184,5 +184,5 @@
             this->printHelp();
             break;
-          case SDLK_2:
+          case SDLK_l:
             for (int i = 0; i < 3; i++)
               {
