Index: branches/bsp_model/src/lib/collision_detection/cd_engine.cc
===================================================================
--- branches/bsp_model/src/lib/collision_detection/cd_engine.cc	(revision 8219)
+++ branches/bsp_model/src/lib/collision_detection/cd_engine.cc	(revision 8220)
@@ -109,5 +109,8 @@
   for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++) {
       for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++)
+      {
+//         PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName());
         (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator);
+      }
   }
 }
Index: branches/bsp_model/src/lib/collision_reaction/collision_handle.cc
===================================================================
--- branches/bsp_model/src/lib/collision_reaction/collision_handle.cc	(revision 8219)
+++ branches/bsp_model/src/lib/collision_reaction/collision_handle.cc	(revision 8220)
@@ -173,4 +173,5 @@
 
  c->registerCollisionEvent(collisionEvent);
+ PRINTF(0)("Registering Collision Event: %s, %s\n", collisionEvent->getEntityA()->getClassName(), collisionEvent->getEntityB()->getClassName());
 }
 
Index: branches/bsp_model/src/lib/event/event_handler.cc
===================================================================
--- branches/bsp_model/src/lib/event/event_handler.cc	(revision 8219)
+++ branches/bsp_model/src/lib/event/event_handler.cc	(revision 8220)
@@ -353,5 +353,5 @@
   else
   {
-//    SDL_WM_GrabInput(SDL_GRAB_ON);
+    SDL_WM_GrabInput(SDL_GRAB_ON);
     SDL_ShowCursor(SDL_DISABLE);
   }
Index: branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8219)
+++ branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc	(revision 8220)
@@ -83,4 +83,6 @@
   this->root  = this->bspFile->get_root();
   this->alreadyVisible = new bool [this->bspFile->numFaces];
+
+  this->outputFraction = 1.0f;
 }
 /*
@@ -853,60 +855,65 @@
 
   Vector position = worldEntity->getAbsCoor();
-
-
-  Vector forwardDir = worldEntity->getAbsDirX();
-  forwardDir.x =8.0*forwardDir.x;
-  forwardDir.y =8.0*forwardDir.y;
-  forwardDir.z =8.0*forwardDir.z;
-
-  Vector upDir = worldEntity->getAbsDirY();
-  Vector dest = position;
-  dest.x  += forwardDir.x;
-  dest.y  += forwardDir.y;
-  dest.z  += forwardDir.z;
-  Vector out = dest;
+  Vector downDir = worldEntity->getAbsDirY();
+  Vector dest = position + downDir * -80.0f;
+
+//   Vector forwardDir = worldEntity->getAbsDirX();
+//   forwardDir.x =8.0*forwardDir.x;
+//   forwardDir.y =8.0*forwardDir.y;
+//   forwardDir.z =8.0*forwardDir.z;
+//
+//   Vector upDir = worldEntity->getAbsDirY();
+//   Vector dest = position;
+//   dest.x  += forwardDir.x;
+//   dest.y  += forwardDir.y;
+//   dest.z  += forwardDir.z;
+//   Vector out = dest;
 
    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 dest2 = position2 + forwardDir;
-   dest = position - Vector(0.0, 20.0,0.0);
-   Vector out1;
-   Vector out2;
-
-   this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
-   if(this->outputFraction == 1.0f)  out1 = dest;
+
+//    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 dest2 = position2 + forwardDir;
+//    dest = position - Vector(0.0, 20.0,0.0);
+//    Vector out1;
+//    Vector out2;
+
+//    this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
+//    if(this->outputFraction == 1.0f)  out1 = dest;
+//    else {
+//      collision = true;
+//      out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction;
+//      out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction;
+//      out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction;
+//
+//    }
+//    this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 );
+//    if(this->outputFraction == 1.0f) out2= dest;
+//    else {
+//      collision = true;
+//      out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction;
+//      out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction;
+//      out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction;
+//
+//    }
+
+   this->checkCollisionRayN(this->root,0.0f, 1.0f, &position, &dest );
+
+   if( this->outputFraction == 1.0f)
+     out = dest;
    else {
+     PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
      collision = true;
-     out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction;
-     out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction;
-     out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction;
-
-   }
-
-   this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 );
-   if(this->outputFraction == 1.0f) out2= dest;
-   else {
-     collision = true;
-     out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction;
-     out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction;
-     out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction;
-
-   }
-
-   this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
-   if(this->outputFraction == 1.0f) out = dest;
-   else {
-     collision = true;
-     out.x = position.x + (dest.x -position.x) * this->outputFraction;
-     out.y = position.y + (dest.y -position.y) * this->outputFraction;
-     out.z = position.z + (dest.z -position.z) * this->outputFraction;
+//      out.x = position.x + (dest.x -position.x) * this->outputFraction;
+//      out.y = position.y + (dest.y -position.y) * this->outputFraction;
+//      out.z = position.z + (dest.z -position.z) * this->outputFraction;
+
+     out = position + (dest - position) * this->outputFraction;
 
      Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z);
-     this->out = out;
-     this->out1 = out1;
-     this->out2 = out2;
+
+
       //this->drawDebugCube(&out1);
       //this->drawDebugCube(&out2);
@@ -917,6 +924,7 @@
 
     // Return the normal here: Normal's stored in this->collPlane;
-   if(collision)
+   if( collision) {
      worldEntity->registerCollision(worldEntity, this->parent, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out);
+   }
 }
 
Index: branches/bsp_model/src/story_entities/game_world.cc
===================================================================
--- branches/bsp_model/src/story_entities/game_world.cc	(revision 8219)
+++ branches/bsp_model/src/story_entities/game_world.cc	(revision 8220)
@@ -428,4 +428,5 @@
   // ground collision detection: BSP Model
   CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getObjectList(OM_GROUP_00));
+  CDEngine::getInstance()->checkCollisionGround(this->dataTank->objectManager->getObjectList(OM_GROUP_01));
 }
 
Index: branches/bsp_model/src/world_entities/bsp_entity.cc
===================================================================
--- branches/bsp_model/src/world_entities/bsp_entity.cc	(revision 8219)
+++ branches/bsp_model/src/world_entities/bsp_entity.cc	(revision 8220)
@@ -10,5 +10,5 @@
 
    ### File Specific:
-   main-programmer: ...
+   main-programmer: Claudio Botta
    co-programmer: ...
 */
@@ -27,4 +27,5 @@
 {
   this->init();
+
   if (root != NULL)
     this->loadParams(root);
@@ -37,14 +38,7 @@
 BspEntity::~BspEntity ()
 {
-
+  if( this->bspManager)
+    delete this->bspManager;
 }
-
-void BspEntity::setName(const std::string& name)
-{
-  PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str());
-
-  this->bspManager->load(name.c_str(), 0.1f);
-}
-
 
 
@@ -55,7 +49,7 @@
 void BspEntity::init()
 {
-  this->bspManager = new BspManager(this);
   this->setClassID(CL_BSP_ENTITY, "BspEntity");
 
+  this->bspManager = new BspManager(this);
   this->toList(OM_ENVIRON);
 
@@ -63,5 +57,12 @@
    * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition)
    */
+}
 
+
+void BspEntity::setName(const std::string& name)
+{
+  PRINTF(0)("+++++++++++ LOADING NAME %s\n", name.c_str());
+
+  this->bspManager->load(name.c_str(), 0.1f);
 }
 
