Index: /branches/bsp_model/src/lib/graphics/graphics_engine.cc
===================================================================
--- /branches/bsp_model/src/lib/graphics/graphics_engine.cc	(revision 8467)
+++ /branches/bsp_model/src/lib/graphics/graphics_engine.cc	(revision 8468)
@@ -66,5 +66,5 @@
 
   this->bDisplayFPS = false;
-  this->bAntialiasing = true;
+  this->bAntialiasing = false;
   this->minFPS = 9999;
   this->maxFPS = 0;
Index: /branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8467)
+++ /branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8468)
@@ -50,7 +50,5 @@
 BspManager::BspManager(WorldEntity* parent)
 {
-  this->outputStartsOut = true;
-  this->outputAllSolid = false;
-  this->outputFraction = 1.0f;
+ 
   this->parent = parent;
   /*// open a BSP file
@@ -595,9 +593,78 @@
   float startFraction = -1.0f;
   float endFraction = 1.0f;
-  bool startsOut = false;
-  bool endsOut = false;
-
-  Vector inputStart = State::getCameraTargetNode()->getLastAbsCoor();
-  Vector inputEnd   = State::getCameraTargetNode()->getAbsCoor();
+  bool  startsOut = false;
+  bool  endsOut = false;
+
+ // Vector inputStart = State::getCameraTargetNode()->getLastAbsCoor();
+ // Vector inputEnd   = State::getCameraTargetNode()->getAbsCoor();
+
+  for (int i = 0; i < curBrush->n_brushsides; i++) {
+    brushside& curBrushSide =   this->bspFile->brushSides[curBrush->brushside + i]   ;
+    plane& curPlane  =   this->bspFile->planes[curBrushSide.plane] ;
+
+    startDistance = inputStart.x * curPlane.x + inputStart.y * curPlane.y+ inputStart.z * curPlane.z - curPlane.d;
+    endDistance = inputEnd.x * curPlane.x +inputEnd.y * curPlane.y +inputEnd.z * curPlane.z -curPlane.d;
+
+    if (startDistance > 0)
+      startsOut = true;
+    if (endDistance > 0)
+      endsOut = true;
+
+    // make sure the trace isn't completely on one side of the brush
+    if (startDistance > 0 && endDistance > 0) {   // both are in front of the plane, its outside of this brush
+      return;
+    }
+    if (startDistance <= 0 && endDistance <= 0) {   // both are behind this plane, it will get clipped by another one
+      continue;
+    }
+
+    // MMM... BEEFY
+    if (startDistance > endDistance) {   // line is entering into the brush
+      float fraction = (startDistance - EPSILON) / (startDistance - endDistance);  // *
+      if (fraction > startFraction)
+        startFraction = fraction;
+      // store plane
+      this->collPlane = &curPlane;
+
+    } else {   // line is leaving the brush
+      float fraction = (startDistance + EPSILON) / (startDistance - endDistance);  // *
+      if (fraction < endFraction)
+        endFraction = fraction;
+      // store plane
+      this->collPlane = & curPlane;
+
+    }
+
+  }
+  if (startsOut == false) {
+    this->outputStartsOut = false;
+    if (endsOut == false)
+      this->outputAllSolid = true;
+    return;
+  }
+
+  if (startFraction < endFraction) {
+    if (startFraction > -1.0f && startFraction < outputFraction) {
+      if (startFraction < 0)
+        startFraction = 0;
+      this->outputFraction = startFraction;
+    }
+  }
+
+}
+
+void BspManager::checkBrushRayN(brush* curBrush, Vector& inputStart, Vector& inputEnd)
+{
+  float EPSILON = 0.000001;
+  float startDistance;
+  float endDistance;
+
+  float startFraction = -1.0f;
+  float endFraction = 1.0f;
+  bool  startsOut = false;
+  bool  endsOut = false;
+
+  //Vector inputStart = State::getCameraTargetNode()->getLastAbsCoor();
+  //Vector inputEnd   = State::getCameraTargetNode()->getAbsCoor();
 
   for (int i = 0; i < curBrush->n_brushsides; i++) {
@@ -870,5 +937,10 @@
 void BspManager::checkCollision(WorldEntity* worldEntity)
 {
-  Vector position = worldEntity->getLastAbsCoor();
+  
+  this->outputStartsOut = true;
+  this->outputAllSolid = false;
+  this->outputFraction = 1.0f;
+  
+  Vector position = worldEntity->getAbsCoor();
 
 
@@ -877,5 +949,8 @@
 
   Vector upDir = worldEntity->getAbsDirY();
-  Vector dest = position;
+  upDir.x = 0.0;
+  upDir.y = 1.0;
+  upDir.z = 0.0;
+  Vector dest;
   /*
   dest.x  += forwardDir.x;
@@ -884,5 +959,5 @@
   */
 
-  dest = worldEntity->getAbsCoor();
+  dest = worldEntity->getAbsCoor() - upDir*40.0;
   Vector out = dest;
 
@@ -901,9 +976,12 @@
 
   float height = 40;
-  this->outputAllSolid = false;
-
+  
+  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();
 
Index: /branches/bsp_model/src/lib/graphics/importer/bsp_manager.h
===================================================================
--- /branches/bsp_model/src/lib/graphics/importer/bsp_manager.h	(revision 8467)
+++ /branches/bsp_model/src/lib/graphics/importer/bsp_manager.h	(revision 8468)
@@ -77,4 +77,6 @@
   void  checkBrushRay(brush* curBrush);
   void  checkBrushRayN(brush* curBrush);
+  void   checkBrushRayN(brush* curBrush, Vector& inputStart, Vector& inputEnd);
+
   void drawDebugCube(Vector* cam);
   bool isAlreadyVisible(int Face);
@@ -94,4 +96,7 @@
   bool  outputAllSolid;
   float outputFraction;
+  Vector inputStart;
+  Vector inputEnd;
+  
   Vector traceMins; //!< Mins of current bbox
   Vector traceMaxs; //!< Maxs of current bbox
