Index: branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8699)
+++ branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8714)
@@ -41,6 +41,4 @@
 #include "world_entity.h"
 
-#include "aabb.h"
-
 #include "util/loading/load_param.h"
 #include "util/loading/factory.h"
@@ -842,5 +840,6 @@
         this->checkBrushRayN(&curBrush);
       if(curBrush.n_brushsides <=0) this->outputAllSolid = true;
-    }
+    } 
+    
     return;
   }
@@ -909,4 +908,15 @@
 
 }
+
+float BspManager::checkPatchAltitude(BspTreeNode* node)
+{
+  leaf& curLeaf = this->bspFile->leaves[node->leafIndex];
+  for(int i = 0; i < curLeaf.n_leaffaces ; i++)
+  {
+   
+  }
+  return 10.0f;
+}
+
 void BspManager::checkCollisionBox(void)
 {
@@ -944,44 +954,23 @@
   this->outputFraction = 1.0f;
 
-  AABB* box = worldEntity->getModelAABB();
-
-
-  Vector forwardDir;
-  Vector upDir;
+
+
+
+  Vector forwardDir = worldEntity->getAbsDirX();
+
+
+  Vector upDir = worldEntity->getAbsDirY();
+  upDir.x = 0.0;
+  upDir.y = 1.0;
+  upDir.z = 0.0;
   Vector dest;
-  Vector position;
-  Vector out;
-  float height;
-
-  if( box != NULL)
-  {
-    forwardDir = worldEntity->getAbsDirX();
-    forwardDir = forwardDir * box->halfLength[0];
-
-    upDir = Vector(0,1,0) * box->halfLength[1];
-
-    position = worldEntity->getAbsCoor() + box->center + box->axis[1] * box->halfLength[1];
-    dest     = worldEntity->getAbsCoor() + box->center - box->axis[1] * box->halfLength[1];
-    out      = dest;
-
-    height = box->halfLength[1];
-  }
-  else
-  {
-    forwardDir = worldEntity->getAbsDirX();
-    forwardDir = forwardDir * 8.0f;
-
-    upDir = worldEntity->getAbsDirY();
-    upDir.x = 0.0;
-    upDir.y = 1.0;
-    upDir.z = 0.0;
-    dest;
-
-    position = worldEntity->getAbsCoor() + upDir*5.0f;
-    dest = worldEntity->getAbsCoor() - upDir*40.0f; //
-    out = dest;
-
-    height = 40;
-  }
+  /*
+  dest.x  += forwardDir.x;
+  dest.y  += forwardDir.y;
+  dest.z  += forwardDir.z;
+  */
+  Vector position = worldEntity->getAbsCoor() + upDir*10.0f ;
+  dest = worldEntity->getAbsCoor() - upDir*40.0f; //
+  Vector out = dest;
 
 
@@ -989,22 +978,25 @@
 
   bool collision = false;
-  Vector position1 = position + Vector(0.0,0.1,0.0);
-  Vector position2 = position + Vector(0.0,0.2,0.0);
-  Vector dest1 = position1 + forwardDir;
+  Vector position1 = position; // + Vector(0.0,0.6,0.0);
+  Vector position2 = position + Vector(0.0,1.0,0.0);
+  Vector dest1 = position + forwardDir*4.0f;
   Vector dest2 = position2 + forwardDir;
-//   dest = position - Vector(0.0, 40.0,0.0);
+  dest = position - Vector(0.0, 40.0,0.0);
   Vector out1;
   Vector out2;
 
 
-
+  float height = 40;
 
   this->inputStart =  position;
   this->inputEnd =   dest;
   this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
+  
+
 
 //   PRINTF(0)(" checking collision: %s, solid = %i, fraction = %f\n", worldEntity->getClassName(), this->outputAllSolid, this->outputFraction);
 //   PRINTF(0)("checking collision!! Pos.Coords: %f , %f , %f\n", position.x , position.y, position.z);
 //   PRINTF(0)("checking collision!! Dest.Coords: %f , %f , %f\n", dest.x , dest.y, dest.z);
+
 //   position1.debug();
 
@@ -1052,10 +1044,29 @@
 
   }
+  
+  plane* testPlane = this->collPlane;
+  
+  this->outputStartsOut = true;
+  this->outputAllSolid = false;
+  this->outputFraction = 1.0f;
+  this->inputStart =  position;
+  this->inputEnd =   dest1;
+  this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest1 );
+  out.x = this->outputFraction;
+  out.z = this->outputFraction;
+  
+  /*
+  out.x = position1.x + (dest.x -position1.x) * this->outputFraction;
+  
+  out.z = position1.z + (dest.z -position1.z) * this->outputFraction;
+  */
+  
+  
   // Return the normal here: Normal's stored in this->collPlane;
   if( collision) {
     PRINTF(5)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
-    worldEntity->registerCollision(this->parent, worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out);
-  }
-  else  worldEntity->registerCollision(this->parent, worldEntity, Vector(0.0, 1.0, 0.0), dest);
+    worldEntity->registerCollision(this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out);
+  }
+  else  worldEntity->registerCollision(this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest);
 
 }
Index: branches/bsp_model/src/lib/graphics/importer/bsp_manager.h
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/bsp_manager.h	(revision 8699)
+++ branches/bsp_model/src/lib/graphics/importer/bsp_manager.h	(revision 8714)
@@ -73,9 +73,10 @@
   void  checkCollisionRay(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end);
   void  checkCollisionRayN(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end);
-  void TraceBox( Vector& inputStart, Vector& inputEnd,Vector& inputMins, Vector& inputMaxs );
+  void  TraceBox( Vector& inputStart, Vector& inputEnd,Vector& inputMins, Vector& inputMaxs );
   void  checkCollisionBox(void);
   void  checkBrushRay(brush* curBrush);
   void  checkBrushRayN(brush* curBrush);
-  void   checkBrushRayN(brush* curBrush, Vector& inputStart, Vector& inputEnd);
+  void  checkBrushRayN(brush* curBrush, Vector& inputStart, Vector& inputEnd);
+  float  checkPatchAltitude(BspTreeNode* node); //! To be implemented...
 
   void drawDebugCube(Vector* cam);
