Index: branches/presentation/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- branches/presentation/src/lib/graphics/importer/bsp_manager.cc	(revision 9086)
+++ branches/presentation/src/lib/graphics/importer/bsp_manager.cc	(revision 9088)
@@ -1146,39 +1146,34 @@
 
 
-/*  Vector forwardDir = Vector(0.0,0.0,1.0);
-  Vector upDir = Vector(0.0,1.0,0.0);*/
-  Vector position = entity->getAbsCoor();
-
-  bool SolidFlag = false;
-
-  plane* testPlane = NULL;
-
-  bool xCollisionRight = false;
-  bool xCollisionLeft = false;
-
-
-  Vector            left;                       //!< left collision ray
-  Vector            right;                      //!< right collision ray
+  plane*            testPlane          = NULL;  //!< the collision test plane
+
+  Vector            forward;                    //!< left collision ray
+  Vector            backward;                   //!< right collision ray
   Vector            collPos;                    //!< the collision position
 
-
-
-
-  Vector dirX =  entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
+  bool              xCollisionForward  = false; //!< flag true if right collision
+  bool              xCollisionBackward = false; //!< flag true if left collision
+  bool              SolidFlag          = false; //!< flag set true if solid
+
+  Vector            position;                   //!< current position of the entity
+  Vector            dirX;                       //!< direction x
+
+  position = entity->getAbsCoor();
+  dirX =  entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
 
   // calculate the rays
   if( box != NULL)
   {
-    left  = entity->getAbsCoor() +  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
-    right = entity->getAbsCoor() -  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
+    forward  = entity->getAbsCoor() +  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
+    backward = entity->getAbsCoor() -  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
   }
   else
   {
-    left  = position + dirX * 4.0f;
-    right = position + Vector(0.0, 1.0, 0.0) + dirX * 4.0;
-  }
-
-
-  /*   X Ray Left  */
+    forward  = position + dirX * 4.0f;
+    backward = position + Vector(0.0, 1.0, 0.0) + dirX * 4.0;
+  }
+
+
+  /*   X Ray forward  */
   // init some member variables before collision check
   this->outputStartsOut = true;
@@ -1186,12 +1181,12 @@
   this->outputFraction = 1.0f;
   this->inputStart =  position;
-  this->inputEnd =   right;
-  this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &right );
+  this->inputEnd =   forward;
+  this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &forward );
 
   // collision occured
   if( this->outputFraction < 1.0f)
   {
-    collPos = position + (right - position) * this->outputFraction;
-    xCollisionRight = true;
+    collPos = position + (forward - position) * this->outputFraction;
+    xCollisionForward = true;
     testPlane = this->collPlane;
   }
@@ -1204,10 +1199,48 @@
     testPlane = this->collPlane;
     SolidFlag = true;
-    xCollisionRight = true;
+    xCollisionForward = true;
   }
 
   // collision registration
-  if( xCollisionRight) {
+  if( xCollisionForward) {
     entity->registerCollision(COLLISION_TYPE_AXIS_X ,
+                              this->parent, entity,
+                              Vector(testPlane->x, testPlane->y, testPlane->z),
+                              collPos,
+                              SolidFlag);
+  }
+
+
+
+  /*   X Ray backward  */
+  // init some member variables before collision check
+  this->outputStartsOut = true;
+  this->outputAllSolid = false;
+  this->outputFraction = 1.0f;
+  this->inputStart =  position;
+  this->inputEnd =   backward;
+  this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &backward );
+
+  // collision occured
+  if( this->outputFraction < 1.0f)
+  {
+    collPos = position + (backward - position) * this->outputFraction;
+    xCollisionBackward = true;
+    testPlane = this->collPlane;
+  }
+  if(this->outputAllSolid )
+  {
+    this->collPlane = new plane;
+    this->collPlane->x = 0.0f;
+    this->collPlane->y = 0.0f;
+    this->collPlane->z = 0.0f;
+    testPlane = this->collPlane;
+    SolidFlag = true;
+    xCollisionBackward = true;
+  }
+
+  // collision registration
+  if( xCollisionBackward) {
+    entity->registerCollision(COLLISION_TYPE_AXIS_X_NEG ,
                               this->parent, entity,
                               Vector(testPlane->x, testPlane->y, testPlane->z),
