Index: /orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h
===================================================================
--- /orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h	(revision 4899)
+++ /orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h	(revision 4900)
@@ -12,5 +12,7 @@
 #include "abstract_model.h"
 
+
 class QuadtreeNode;
+class Material;
 
 //! A class for quadtree separation of the world
Index: /orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
===================================================================
--- /orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc	(revision 4899)
+++ /orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc	(revision 4900)
@@ -30,5 +30,5 @@
                             const float* pVertices, int numVertices,
                             Quadtree* quadtree, QuadtreeNode* parent,
-                            Rectangle* rect, int treeDepth, const int maxDepth
+                            Rectangle* rect, int treeDepth, const int maxDepth, int index
                            )
 {
@@ -44,4 +44,5 @@
   this->treeDepth = treeDepth;
   this->maxDepth = maxDepth;
+  this->indexNode = index;
 
 
@@ -49,5 +50,5 @@
   for( int i = 0; i < this->treeDepth; ++i)
     PRINT(3)(" |");
-  PRINT(3)(" | +-| (Event) Separating Node Depth: %i/%i\n", treeDepth, maxDepth);
+  PRINT(3)(" | +-| (Event) Separating Node Nr. %i Depth: %i/%i\n", this->indexNode, treeDepth, maxDepth);
 
   for( int i = 0; i < this->treeDepth; ++i)
@@ -74,11 +75,13 @@
   for( int i = 0; i < this->pModelInfo->numTriangles; ++i)
     this->pTriangles[i] = &this->pModelInfo->pTriangles[i];
+
   this->treeDepth = 0;
   this->maxDepth = maxDepth;
+  this->indexNode = 0;
 
   /* debug output */
   for( int i = 0; i < this->treeDepth; ++i)
     PRINT(3)(" |");
-  PRINT(3)(" | +-| (Event) Separating Node Depth: %i/%i\n", treeDepth, maxDepth);
+  PRINT(3)(" | +-| (Event) Separating Node Nr. %i Depth: %i/%i\n", this->indexNode, treeDepth, maxDepth);
 
   this->pDimension = this->getDimFromModel();
@@ -164,9 +167,9 @@
           if( pVert[0] > rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset)
             listA->add(&this->pTriangles[i]);
-          if( pVert[0] > rectCenter->x + this->offset && pVert[2]< rectCenter->z + this->offset)
+          if( pVert[0] < rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset)
             listB->add(&this->pTriangles[i]);
-          if( pVert[0] < rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset)
+          if( pVert[0] < rectCenter->x + this->offset && pVert[2] < rectCenter->z + this->offset)
             listC->add(&this->pTriangles[i]);
-          if( pVert[0] < rectCenter->x + this->offset && pVert[2] < rectCenter->z + this->offset)
+          if( pVert[0] > rectCenter->x + this->offset && pVert[2] < rectCenter->z + this->offset)
             listD->add(&this->pTriangles[i]);
         }
@@ -252,4 +255,5 @@
 
   v.x = this->pDimension->getCenter()->x + this->pDimension->getAxis() / 2.0f;
+  v.y = 0.0;
   v.z = this->pDimension->getCenter()->z + this->pDimension->getAxis() / 2.0f;
   Rectangle* rA = new Rectangle(v, this->pDimension->getAxis() / 2.0f);
@@ -265,8 +269,11 @@
 
   /* now propagate */
-  this->nodeA = new QuadtreeNode(pTriA, lenA, this->pVertices, this->numVertices, this->quadtree, this, rA, this->treeDepth + 1, this->maxDepth);
-  this->nodeB = new QuadtreeNode(pTriB, lenB, this->pVertices, this->numVertices, this->quadtree, this, rB, this->treeDepth + 1, this->maxDepth);
-  this->nodeC = new QuadtreeNode(pTriC, lenC, this->pVertices, this->numVertices, this->quadtree, this, rC, this->treeDepth + 1, this->maxDepth);
-  this->nodeD = new QuadtreeNode(pTriD, lenD, this->pVertices, this->numVertices, this->quadtree, this, rD, this->treeDepth + 1, this->maxDepth);
+  this->nodeA = new QuadtreeNode(pTriA, lenA, this->pVertices, this->numVertices, this->quadtree, this, rA, this->treeDepth + 1, this->maxDepth, (this->treeDepth + 1) * 10 + 0);
+
+  this->nodeB = new QuadtreeNode(pTriB, lenB, this->pVertices, this->numVertices, this->quadtree, this, rB, this->treeDepth + 1, this->maxDepth, (this->treeDepth + 1) * 10 + 1);
+
+  this->nodeC = new QuadtreeNode(pTriC, lenC, this->pVertices, this->numVertices, this->quadtree, this, rC, this->treeDepth + 1, this->maxDepth, (this->treeDepth + 1) * 10 + 2);
+
+  this->nodeD = new QuadtreeNode(pTriD, lenD, this->pVertices, this->numVertices, this->quadtree, this, rD, this->treeDepth + 1, this->maxDepth, (this->treeDepth + 1) * 10 + 3);
 }
 
Index: /orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h
===================================================================
--- /orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h	(revision 4899)
+++ /orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h	(revision 4900)
@@ -23,5 +23,5 @@
                  const float* pVertices, int numVertices,
                  Quadtree* quadtree, QuadtreeNode* parent,
-                 Rectangle* rect, int treeDepth, const int maxDepth);
+                 Rectangle* rect, int treeDepth, const int maxDepth, int index);
     QuadtreeNode(modelInfo* pModelInfo, const int maxDepth);
     virtual ~QuadtreeNode();
@@ -54,4 +54,5 @@
     int                             treeDepth;          //!< the depth of the tree
     int                             maxDepth;           //!< the maximal depth of the tree
+    int                             indexNode;          //!< the index number of the node
 
     sTriangleExt**                  pTriangles;         //!< reference to the triangles of the node
