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();
     }
   }
