Index: branches/ODE/configure.ac
===================================================================
--- branches/ODE/configure.ac	(revision 9918)
+++ branches/ODE/configure.ac	(revision 9919)
@@ -304,5 +304,5 @@
 #-----#
 AX_CHECK_REQUIRED_HEADER_LIB([ode/ode.h],[ode],[main],,,[http://www.ode.org])
-
+	
 
     ;;
Index: branches/ODE/src/lib/graphics/importer/bsp_file.cc
===================================================================
--- branches/ODE/src/lib/graphics/importer/bsp_file.cc	(revision 9918)
+++ branches/ODE/src/lib/graphics/importer/bsp_file.cc	(revision 9919)
@@ -39,4 +39,6 @@
 // STL Containers
 #include <vector>
+
+#include<ode/ode.h>
 
 
@@ -332,4 +334,8 @@
     this->patchTrianglesPerRow = new char[7*4*this->numPatches];
     this->VertexArrayModels  = new VertexArrayModel*[this->numPatches];
+    
+    this->ODE_Geometry = new dTriMeshDataID[this->numPatches*7*7];
+    this->ODE_Geom_IDs = new dGeomID[this->numPatches* 7 *7];
+
 
     PRINTF(4)("BSP FILE:NumberOfPatches: %i . \n", numPatches);
@@ -729,4 +735,12 @@
  */
 
+uint  Ind [] = {8,0,9,     0,1,9,     9,1,10,   1,2,10,    10,2,11,  2,3,11,   11,3,12,  3,4,12,    12,4,13,  4,5,13,   13,5,14,   5,6,14,   14,6,15,  6,7,15,  
+		16,8,17,   8,9,17,    17,9,18,  9,10,18,   18,10,19, 10,11,19, 19,11,20, 11,12,20,  20,12,21, 12,13,21, 21,13,22, 13,14,22,  22,14,23, 14,15,23, 
+		24,16,25,  16,17,25,  25,17,26, 17,18,26,  26,18,27, 18,19,27, 27,19,28, 19,20,28,  28,20,29, 20,21,29, 29,21,30, 21,22,30,  30,22,31, 22,23,31, 
+		32,24,33,  24,25,33,  33,25,34, 25,26,34,  34,26,35, 26,27,35, 35,27,36, 27,28,36,  36,28,37, 28,29,37 ,37,29,38, 29,30,38,  38,30,39, 30,31,39, 
+		40,32,41,  32,33,41,  41,33,42, 33,34,42,  42,34,43, 34,35,43, 43,35,44, 35,36,44,  44,36,45, 36,37,45, 45,37,46, 37,38,46,  46,38,47, 38,39,47, 
+		48,40,49,  40,41,49,  49,41,50, 41,42,50,  50,42,51, 42,43,51, 51,43,52, 43,44,52,  52,44,53, 44,45,53, 53,45,54, 45,46,54,  54,46,55, 46,47,55, 
+		56,48,57,  48,49,57,  57,49,58, 49,50,58,  58,50,59, 50,51,59, 59,51,60, 51,52,60,  60,52,61, 52,53,61, 61,53,62, 52,54,62,  62,54,63, 54,55,63, 0 };
+
 
 void BspFile::tesselate(int iface)
@@ -877,5 +891,5 @@
       }
 
-      //Create indices
+      // Create indices
       GLuint* indices= & ((GLuint*)(this->patchIndexes))[level*level1*2*this->patchOffset];
 
@@ -888,4 +902,8 @@
         }
       }
+	
+	this->ODE_Geometry[this->patchOffset] = dGeomTriMeshDataCreate();
+     // Create ODE Triangle Mesh Geometry
+	dGeomTriMeshDataBuildSingle(this->ODE_Geometry[this->patchOffset], &((((BspVertex*)(this->patchVertice))[level1*level1*this->patchOffset ]).position[0]), sizeof(BspVertex), level1*level1, &(Ind[0]) ,7*14*3, 3* sizeof(uint) );
 
 
Index: branches/ODE/src/lib/graphics/importer/bsp_file.h
===================================================================
--- branches/ODE/src/lib/graphics/importer/bsp_file.h	(revision 9918)
+++ branches/ODE/src/lib/graphics/importer/bsp_file.h	(revision 9919)
@@ -19,4 +19,6 @@
 
 #include <vector>
+#include <ode/ode.h>
+
 class SDL_Surface;
 class BspTreeNode;
@@ -86,5 +88,5 @@
 {
   int texture;    	//!< Texture index.
-  int effect; 	        //!< Index into lump 12 (Effects), or -1.
+  int effect; 	        //!< Index into lump #include <ode/ode.h>12 (Effects), or -1.
   int type; 	        //!< Face type. 1=polygon, 2=patch, 3=mesh, 4=billboard
   int vertex; 	        //!< Index of first vertex.
@@ -159,4 +161,5 @@
   AMat loadMat( char* mat );
   AMat loadAVI(char * mat);
+  dTriMeshDataID*    getODE_Geometry(void) {return this->ODE_Geometry;}
  
 
@@ -215,4 +218,7 @@
  
   ::std::vector<MoviePlayer* > MovieMaterials; //!< Movieplayer Materials
+
+  dTriMeshDataID*   ODE_Geometry; //!< ODE Geometry Data for patches
+  dGeomID*          ODE_Geom_IDs; //!< IDs of ODE Geometry Data
 };
 
Index: branches/ODE/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- branches/ODE/src/lib/graphics/importer/bsp_manager.cc	(revision 9918)
+++ branches/ODE/src/lib/graphics/importer/bsp_manager.cc	(revision 9919)
@@ -48,4 +48,6 @@
 #include "cr_defs.h"
 
+#include<ode/ode.h>
+
 
 //CREATE_FACTORY( BspManager, CL_BSP_MODEL);
@@ -88,4 +90,18 @@
 {
   // open a BSP file
+  this->world =  dWorldCreate();
+  space = dSimpleSpaceCreate(0);
+ 
+   //!fixme
+  for (int i=0; i<30; i++) {
+    contact[i].surface.mode = dContactBounce | dContactSoftCFM;
+    contact[i].surface.mu = dInfinity;
+    contact[i].surface.mu2 = 0;
+    contact[i].surface.bounce = 0.1;
+    contact[i].surface.bounce_vel = 0.1;
+    contact[i].surface.soft_cfm = 0.01;
+  }
+
+
 
 
@@ -101,4 +117,14 @@
   this->outputFraction = 1.0f;
 
+  contactgroup = dJointGroupCreate (0);
+  dWorldSetGravity (world,0,0,-0.5);
+  dWorldSetCFM (world,1e-5);
+ this->ODE_Geom_IDs = new dGeomID[this->bspFile->numPatches* 7 *7];
+
+  for( int i = 0 ; i < (this->bspFile->numPatches ); i++ )
+	{ 
+    		this->ODE_Geom_IDs[i] = dCreateTriMesh(space,(this->bspFile->getODE_Geometry())[i],0 , 0, 0);
+
+	}
   return 0;
 }
@@ -970,179 +996,133 @@
 
 
-#if 0
-  // Retrieve Bounding box
-  AABB* box = worldEntity->getModelAABB();
-
-
-  Vector forwardDir = Vector(0.0,0.0,1.0);
-  Vector upDir = Vector(0.0,1.0,0.0);
-  Vector position = worldEntity->getAbsCoor();
-
-  bool SolidFlag = false;
-  bool collision = false;
-  Vector position1 = position;
-  Vector position2 = position + Vector(0.0,1.0,0.0);
-  Vector position3 = position;
-  Vector position4 = position + Vector(0.0,1.0,0.0);
-  Vector dest = worldEntity->getAbsCoor() - upDir*40.0f; //
-  Vector dest1 = position + forwardDir*4.0f;
-  Vector dest2 = position2 + forwardDir*4.0;
-  Vector dest3 = position + forwardDir*4.0f;
-  Vector dest4 = position2 + forwardDir*4.0;
-  dest = position - Vector(0.0, 40.0,0.0);
-  Vector out = dest;
-  Vector out1;
-  Vector out2;
-
-
-  plane* testPlane;
-
-  bool xCollision = false;
-  bool zCollision = false;
-
-
-  float height = 40;
-
-
-  if( box != NULL) {
-    position = worldEntity->getAbsCoor() +  box->center; // + Vector(0.0, 1.0, 0.0) * box->halfLength[1] * 1.0f;
-    dest     = worldEntity->getAbsCoor() +  box->center - Vector(0.0, 1.0, 0.0) * (box->halfLength[1] + BSP_Y_OFFSET) *   100;
-
-    Vector dirX =  worldEntity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
-
-    //position1 = worldEntity->getAbsCoor() +  box->center - dirX * (box->halfLength[0]  + BSP_X_OFFSET);
-    dest1     = worldEntity->getAbsCoor() +  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
-    dest2     = worldEntity->getAbsCoor() -  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
-
-    Vector dirZ =  worldEntity->getAbsDirZ(); dirX.y = 0.0f; dirZ.normalize();
-    //position2 = worldEntity->getAbsCoor() +  box->center - dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
-    dest3     = worldEntity->getAbsCoor() +  box->center + dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
-    dest4     = worldEntity->getAbsCoor() -  box->center + dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
-  } else {
-    // Init positions and destinations to anything useful!
-
-  }
-
-
-
-  // 1st Ray: Y RAY
-  this->inputStart =  position;
-  this->inputEnd =   dest;
-  this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
-
-
-  //
-  if(!this->outputStartsOut ) {
-    this->collPlane = new plane;
-    this->collPlane->x = 0.0f;
-    this->collPlane->y = 0.0f;
-    this->collPlane->z = 0.0f;
-    collision = true;
-  } else {
-
-    if( this->outputFraction == 1.0f) {
-      if(this->outputAllSolid ) {
-        this->collPlane = new plane;
-        this->collPlane->x = 0.0f;
-        this->collPlane->y = 0.0f;
-        this->collPlane->z = 0.0f;
-        collision = true;
-        SolidFlag = true;
-      } else
-        collision = false;
-
-
-      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;
-
-      Vector out3 = out + Vector(height*this->collPlane->x,height*this->collPlane->y,height*this->collPlane->z);
-      this->out = out;
-    }
-  }
-    testPlane = this->collPlane;
-
-
-  bool xCollisionNeg = false;
-  bool zCollisionNeg = false;
-
-
-
-    // 2nd Collision Detection X-RAY
-    this->outputStartsOut = true;
-    this->outputAllSolid = false;
-    this->outputFraction = 1.0f;
-    this->inputStart =  position1;
-    this->inputEnd =   dest1;
-    this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
-
-    if(this->outputFraction < 1.0f) {
-      out.x = dest1.x + (dest1.x -position1.x) * this->outputFraction;
-      dest1 = position1 + (dest1 -position1) * this->outputFraction;
-      xCollision = 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;
-      xCollision = true;
-    }
-    //out.z = this->outputFraction;
-
-
-
-      // 3rd Collision Detection Z-RAY
-      this->outputStartsOut = true;
-      this->outputAllSolid = false;
-      this->outputFraction = 1.0f;
-      this->inputStart =  position2;
-      this->inputEnd =   dest2;
-
-      this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 );
-      //out.x = this->outputFraction;
-
-      if(this->outputFraction < 1.0f ) {
-        out.z = out.z = dest2.z + (dest2.z -position2.z) * this->outputFraction;
-        dest2 = position2 + (dest2 -position2) * this->outputFraction;
-        zCollision = 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;
-        zCollision = true;
-      }
-
-
-  // Return the normal here: Normal's stored in this->collPlane;
-  if( collision) {
-    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
-}
-  if(xCollision) {
-    worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , SolidFlag);
-  }
-
-  if(zCollision) {
-    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), dest2 , SolidFlag);
-  }
-#endif
-
-}
-
+
+
+// Create the World-Entities BBOX
+   AABB* box = worldEntity->getModelAABB();
+   dReal  aabbox [6];
+
+if(  box != NULL)
+{
+	
+	dGeomID RayX =    dCreateRay(space,box->halfLength[0] *2.0f);
+	dGeomRaySet (RayX, worldEntity->getAbsCoor().x  - box->halfLength[0]  ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
+                  1.0f, 0.0f, 0.0f); 
+	dGeomID RayY =    dCreateRay(space,box->halfLength[1] *2.0f);
+	dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y - box->halfLength[1], worldEntity->getAbsCoor().z,
+                  0.0f, 1.0f, 0.0f); 
+	dGeomID RayZ =    dCreateRay(space,box->halfLength[2] *2.0f);
+	dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z - box->halfLength[2],
+                  0.0f, 0.0f, 1.0f); 
+
+	dGeomID RayXPos =    dCreateRay(space,box->halfLength[0]);
+	dGeomRaySet (RayX, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
+                  1.0f, 0.0f, 0.0f); 
+	dGeomID RayYPos =    dCreateRay(space,box->halfLength[1] );
+	dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
+                  0.0f, 1.0f, 0.0f); 
+	dGeomID RayZPos =    dCreateRay(space,box->halfLength[2] );
+	dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
+                  0.0f, 0.0f, 1.0f); 
+
+	dGeomID RayXNeg =    dCreateRay(space,box->halfLength[0] * 40.0f );
+	dGeomRaySet (RayX, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
+                  -1.0f, 0.0f, 0.0f); 
+	dGeomID RayYNeg =    dCreateRay(space,box->halfLength[1] );
+	dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y , worldEntity->getAbsCoor().z,
+                  0.0f, -1.0f, 0.0f); 
+	dGeomID RayZNeg =    dCreateRay(space,box->halfLength[2] );
+	dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z ,
+                  0.0f, 0.0f, -1.0f); 
+
+ 
+    	dGeomID BBOX = dCreateBox (space,box->halfLength[0]*2.0f, box->halfLength[1]*40.0f + BSP_Y_OFFSET*30.0f ,2.0f* box->halfLength[2]);
+    	dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x  ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z);
+   	dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x + box->center.x ,worldEntity->getAbsCoor().y+box->center.y, worldEntity->getAbsCoor().z+box->center.z);
+
+
+dGeomID BBOX2 ;
+ 
+   int g;
+   bool collision = false;
+
+   for( int i = 0 ; i < this->bspFile->numPatches /* * 7 */; i++ )
+	{  
+			// dGeomGetAABB (this->bspFile->ODE_Geom_IDs[i],aabbox );
+			// BBOX2 = dCreateBox (space, aabbox[1]-aabbox[0], aabbox[3]-aabbox[2], aabbox[5]-aabbox[4]);
+			//  dGeomSetPosition (BBOX2,(aabbox[1]+ aabbox[0])/2, (aabbox[3]+ aabbox[2])/2, (aabbox[4]+ aabbox[5])/2);
+			// dGeomDestroy(BBOX2);
+			 g = 0;
+			 if(dCollide(this->ODE_Geom_IDs[i],BBOX, 1, &contact[0].geom, sizeof(dContact)) ) {
+					
+					if(dCollide(this->ODE_Geom_IDs[i],RayX, 1, &contact[0].geom, sizeof(dContact)))  {
+						if(dCollide(this->ODE_Geom_IDs[i],RayXPos, 1, &contact[0].geom, sizeof(dContact)))  {
+						          worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(1.0f, 0.0f, 0.0f),
+                                                          Vector((float)contact[0].geom.pos[0],(float)contact[0].geom.pos[1],contact[0].geom.pos[2]), false);	
+							
+						}//if		
+						if(dCollide(this->ODE_Geom_IDs[i],RayXNeg, 1, &contact[0].geom, sizeof(dContact)))  {
+							  worldEntity->registerCollision(COLLISION_TYPE_AXIS_X_NEG , this->parent, worldEntity, Vector(1.0f, 0.0f, 0.0f),
+                                                          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+							 
+						}//if
+					}//if
+				
+					
+					if(dCollide(this->ODE_Geom_IDs[i],RayY, 1, &contact[0].geom, sizeof(dContact)))  {
+						
+						// worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(0.0f, 1.0f, 0.0f),
+                                                //          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+
+						//PRINTF(0)("Ground \n");
+						if(dCollide(this->ODE_Geom_IDs[i],RayYPos, 1, &contact[0].geom, sizeof(dContact)))  {
+							  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(0.0f, 1.0f, 0.0f),
+                                                          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1] ,contact[0].geom.pos[2]), false);
+							
+						}//if
+						else if(dCollide(this->ODE_Geom_IDs[i],RayYNeg, 1, &contact[0].geom, sizeof(dContact)))  {
+							  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(0.0f, 1.0f, 0.0f),
+                                                          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+							
+						}//if
+						else {
+
+						worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(0.0f, 1.0f, 0.0f),
+                                                          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+
+						}
+
+					}//if
+				
+					if(dCollide(this->ODE_Geom_IDs[i],RayZ, 1, &contact[0].geom, sizeof(dContact)))  {
+						if(dCollide(this->ODE_Geom_IDs[i],RayZPos, 1, &contact[0].geom, sizeof(dContact)))  {
+							  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(0.0f, 0.0f, 1.0f),
+                                                         Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+							
+						}//if
+						if(dCollide(this->ODE_Geom_IDs[i],RayZNeg, 1, &contact[0].geom, sizeof(dContact)))  {
+							  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z_NEG , this->parent, worldEntity, Vector(0.0f, 0.0f, 1.0f),
+                                                          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+							
+						}//if
+
+
+					}//if
+			
+			} //if
+		} //for
+			
+      dGeomDestroy(RayX);
+      dGeomDestroy(RayY);
+      dGeomDestroy(RayZ);
+      dGeomDestroy(RayXPos);
+      dGeomDestroy(RayYPos);
+      dGeomDestroy(RayZPos);
+      dGeomDestroy(RayXNeg);
+      dGeomDestroy(RayYNeg);
+      dGeomDestroy(RayZNeg);
+	
+     dGeomDestroy(BBOX);
+} // if(bbox != 0)
+}
 
 
Index: branches/ODE/src/lib/graphics/importer/bsp_manager.h
===================================================================
--- branches/ODE/src/lib/graphics/importer/bsp_manager.h	(revision 9918)
+++ branches/ODE/src/lib/graphics/importer/bsp_manager.h	(revision 9919)
@@ -26,4 +26,5 @@
 #include <vector>
 #include <deque>
+#include <ode/ode.h>
 
 
@@ -136,4 +137,11 @@
 
   int tgl;
+
+    dWorldID world;
+   dSpaceID space;
+   dJointGroupID contactgroup;
+   dContact contact[300];
+   dGeomID*          ODE_Geom_IDs; //!< IDs of ODE Geometry Data
+
 };
 
Index: branches/ODE/src/lib/graphics/importer/static_model.h
===================================================================
--- branches/ODE/src/lib/graphics/importer/static_model.h	(revision 9918)
+++ branches/ODE/src/lib/graphics/importer/static_model.h	(revision 9919)
@@ -61,4 +61,5 @@
   void acquireData(const StaticModelData::Pointer& data);
   const StaticModelData::Pointer& dataPointer() const { return this->data; };
+	//StaticModelData* dataPointer(){return this->data;};
 
   inline void setScaleFactor(float scaleFactor) { this->data->setScaleFactor(scaleFactor); };
Index: branches/ODE/src/lib/graphics/text_engine/text_engine.cc
===================================================================
--- branches/ODE/src/lib/graphics/text_engine/text_engine.cc	(revision 9918)
+++ branches/ODE/src/lib/graphics/text_engine/text_engine.cc	(revision 9919)
@@ -86,5 +86,5 @@
 void TextEngine::enableFonts()
 {
-  if (!TTF_WasInit())
+  if (false /*!TTF_WasInit()*/)
   {
     if(TTF_Init()==-1)
@@ -102,5 +102,5 @@
 void TextEngine::disableFonts()
 {
-  if (TTF_WasInit())
+  if (false /*TTF_WasInit()*/)
   {
     //      Font::removeDefaultFont();
@@ -141,6 +141,6 @@
   SDL_version compile_version;
   SDL_version link_version;
-  TTF_VERSION(&compile_version);
-  link_version = *TTF_Linked_Version();
+  //TTF_VERSION(&compile_version);
+ // link_version = *TTF_Linked_Version();
 
   if (compile_version.major == link_version.major &&
Index: branches/ODE/src/world_entities/creatures/fps_player.cc
===================================================================
--- branches/ODE/src/world_entities/creatures/fps_player.cc	(revision 9918)
+++ branches/ODE/src/world_entities/creatures/fps_player.cc	(revision 9919)
@@ -39,4 +39,5 @@
 
 #include "shared_network_data.h"
+#include "terrain.h"
 
 
@@ -167,5 +168,6 @@
 
     //subscribe to collision reaction
-  this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID());
+  //this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID());
+this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, Terrain::staticClassID());
 
   this->initWeapon = false;
Index: branches/ODE/src/world_entities/npcs/generic_npc.cc
===================================================================
--- branches/ODE/src/world_entities/npcs/generic_npc.cc	(revision 9918)
+++ branches/ODE/src/world_entities/npcs/generic_npc.cc	(revision 9919)
@@ -32,4 +32,5 @@
 
 #include "bsp_entity.h"
+#include "terrain.h"
 
 #include "class_id_DEPRECATED.h"
@@ -96,5 +97,6 @@
 
   // collision reaction registration
-  this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID());
+  //this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID());
+   this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, Terrain::staticClassID());
 }
 
Index: branches/ODE/src/world_entities/terrain.cc
===================================================================
--- branches/ODE/src/world_entities/terrain.cc	(revision 9918)
+++ branches/ODE/src/world_entities/terrain.cc	(revision 9919)
@@ -24,4 +24,6 @@
 
 #include "model.h"
+#include "static_model.h"
+#include "static_model_data.h"
 #include "network_game_manager.h"
 
@@ -33,6 +35,10 @@
 #include "state.h"
 #include "debug.h"
+#include "aabb.h"
+#include "cr_defs.h"
+#include "cd_engine.h"
 
 #include "class_id_DEPRECATED.h"
+#include  <ode/ode.h>
 ObjectListDefinitionID(Terrain, CL_TERRAIN);
 CREATE_FACTORY(Terrain);
@@ -43,4 +49,5 @@
 Terrain::Terrain (const TiXmlElement* root)
 {
+  this->loaded = false;
   this->init();
 
@@ -49,4 +56,51 @@
     this->loadParams(root);
 
+
+if(this->getModel())
+	{
+
+ 	StaticModelData::Pointer   ModelData = ((StaticModel*)this->getModel())->dataPointer();
+	//ModelData->buildTriangleList();
+
+	PRINTF(0)(" Dieses Model hat %i Vertices \n", ModelData->getVertices().size());
+	PRINTF(0)(" Dieses Model hat %i Dreiecke \n",((ModelData->getTriangles()).size()  ));
+	this->Ind = new unsigned int [(ModelData->getTriangles()).size()*3];
+	for(int i = 0 ; i < (ModelData->getTriangles()).size(); i++)
+		{
+			Ind[3*i]    = (ModelData->getTrianglesExt())[i].indexToVertices[0] / 3 ;
+			Ind[3*i +1] = (ModelData->getTrianglesExt())[i].indexToVertices[1] / 3;
+			Ind[3*i +2] = (ModelData->getTrianglesExt())[i].indexToVertices[2] / 3;
+		
+		}
+	
+	//((StaticModel*)(this->getModel()))->acquireData(ModelData);
+	this->ODE_Geometry = dGeomTriMeshDataCreate();
+	dGeomTriMeshDataBuildSingle(this->ODE_Geometry,&((ModelData->getVertices())[0]), 3*sizeof(float),(ModelData->getVertices().size() /3 )  , &Ind[0] ,((ModelData->getTriangles()).size() *3 ),  3*sizeof(unsigned int) );
+    // Create ODE-Data here!
+	
+	this->world =  dWorldCreate();
+ 	this->space = dSimpleSpaceCreate(0);
+ 
+   	//!fixme
+  	for (int i=0; i<30; i++) {
+    		contact[i].surface.mode = dContactBounce | dContactSoftCFM;
+    		contact[i].surface.mu = dInfinity;
+    		contact[i].surface.mu2 = 0;
+    		contact[i].surface.bounce = 0.1;
+    		contact[i].surface.bounce_vel = 0.1;
+    		contact[i].surface.soft_cfm = 0.01;
+  	}
+
+	contactgroup = dJointGroupCreate (0);
+ 	dWorldSetGravity (world,0,0,-0.5);
+  	dWorldSetCFM (world,1e-5);
+
+	this->ODE_Geom_ID = dCreateTriMesh(space,this->ODE_Geometry,0 , 0, 0);
+
+		
+	CDEngine::getInstance()->setTerrain(this);
+	this->loaded = true;
+	this->toList(OM_ENVIRON);
+}
   //  if (this->model != NULL)
   //this->ssp = new SpatialSeparation((Model*)this->model, 10.0f);
@@ -62,4 +116,5 @@
 Terrain::Terrain(const std::string& fileName)
 {
+  this->loaded = false;
   this->init();
 
@@ -67,4 +122,6 @@
   {
     this->loadModel(fileName);
+
+	
   }
   else
@@ -112,4 +169,6 @@
 
   this->heightMapMaterial = new Material();
+
+
 }
 
@@ -428,2 +487,142 @@
   return 0;
 }
+
+void Terrain::go()
+	{
+	PRINTF(0)("It's me!   :-)");
+	}
+
+void Terrain::checkCollisionTerrain(WorldEntity* worldEntity) {
+	if(!this->loaded) return;
+	
+	 AABB* box = worldEntity->getModelAABB();
+   dReal  aabbox [6];
+
+if(  box != NULL)
+{
+	
+	dGeomID RayX =    dCreateRay(space,box->halfLength[0] *2.0f);
+	dGeomRaySet (RayX, worldEntity->getAbsCoor().x  - box->halfLength[0]  ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
+                  1.0f, 0.0f, 0.0f); 
+	dGeomID RayY =    dCreateRay(space,box->halfLength[1] *2.0f);
+	dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y - box->halfLength[1], worldEntity->getAbsCoor().z,
+                  0.0f, 1.0f, 0.0f); 
+	dGeomID RayZ =    dCreateRay(space,box->halfLength[2] *2.0f);
+	dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z - box->halfLength[2],
+                  0.0f, 0.0f, 1.0f); 
+
+	dGeomID RayXPos =    dCreateRay(space,box->halfLength[0]);
+	dGeomRaySet (RayX, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
+                  1.0f, 0.0f, 0.0f); 
+	dGeomID RayYPos =    dCreateRay(space,box->halfLength[1] );
+	dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
+                  0.0f, 1.0f, 0.0f); 
+	dGeomID RayZPos =    dCreateRay(space,box->halfLength[2] );
+	dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
+                  0.0f, 0.0f, 1.0f); 
+
+	dGeomID RayXNeg =    dCreateRay(space,box->halfLength[0] * 40.0f );
+	dGeomRaySet (RayX, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
+                  -1.0f, 0.0f, 0.0f); 
+	dGeomID RayYNeg =    dCreateRay(space,box->halfLength[1] );
+	dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y , worldEntity->getAbsCoor().z,
+                  0.0f, -1.0f, 0.0f); 
+	dGeomID RayZNeg =    dCreateRay(space,box->halfLength[2] );
+	dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z ,
+                  0.0f, 0.0f, -1.0f); 
+
+ 
+    	dGeomID BBOX = dCreateBox (space,box->halfLength[0]*2.0f, box->halfLength[1]*40.0f  ,2.0f* box->halfLength[2]);
+    	//dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x  ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z);
+   	dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x + box->center.x ,worldEntity->getAbsCoor().y+box->center.y, worldEntity->getAbsCoor().z+box->center.z);
+
+
+
+ 
+   int g;
+   bool collision = false;
+
+ 
+			// dGeomGetAABB (this->bspFile->ODE_Geom_IDs[i],aabbox );
+			// BBOX2 = dCreateBox (space, aabbox[1]-aabbox[0], aabbox[3]-aabbox[2], aabbox[5]-aabbox[4]);
+			//  dGeomSetPosition (BBOX2,(aabbox[1]+ aabbox[0])/2, (aabbox[3]+ aabbox[2])/2, (aabbox[4]+ aabbox[5])/2);
+			// dGeomDestroy(BBOX2);
+			 g = 0;
+			 if(true || dCollide(this->ODE_Geom_ID,BBOX, 10, &contact[0].geom, sizeof(dContact)) ) {
+			
+				//PRINTF(0)("Collision \n");
+				for(int i = 0; i <1 ; i++)
+					{ 
+				// worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this, worldEntity, Vector(0.0f, 1.0f, 0.0f),
+                                  //              Vector(contact[i].geom.pos[0],contact[i].geom.pos[1],contact[i].geom.pos[2]), false);
+					}
+					
+					if(dCollide(this->ODE_Geom_ID,RayX, 1, &contact[0].geom, sizeof(dContact)))  {
+						if(dCollide(this->ODE_Geom_ID,RayXPos, 1, &contact[0].geom, sizeof(dContact)))  {
+						         worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this, worldEntity, Vector(1.0f, 0.0f, 0.0f),
+                                                         Vector((float)contact[0].geom.pos[0],(float)contact[0].geom.pos[1],contact[0].geom.pos[2]), false);	
+							
+						}//if		
+						if(dCollide(this->ODE_Geom_ID,RayXNeg, 1, &contact[0].geom, sizeof(dContact)))  {
+							  worldEntity->registerCollision(COLLISION_TYPE_AXIS_X_NEG , this, worldEntity, Vector(1.0f, 0.0f, 0.0f),
+                                                         Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+							 
+						}//if
+					}//if
+				
+					
+					if(dCollide(this->ODE_Geom_ID,RayY, 1, &contact[0].geom, sizeof(dContact)))  {
+						
+						
+						if(dCollide(this->ODE_Geom_ID,RayYNeg, 1, &contact[0].geom, sizeof(dContact)))  {
+							 worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this, worldEntity, Vector(0.0f, 1.0f, 0.0f),
+                                                         Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+						
+							
+						}//if
+						else if(dCollide(this->ODE_Geom_ID,RayYPos, 1, &contact[0].geom, sizeof(dContact)))  {
+							  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this, worldEntity, Vector(0.0f, 1.0f, 0.0f),
+                                                         Vector(contact[0].geom.pos[0],contact[0].geom.pos[1] ,contact[0].geom.pos[2]), false);
+							
+						}//if
+						else {
+
+						worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this, worldEntity, Vector(0.0f, 1.0f, 0.0f),
+                                                        Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+
+						}
+
+					}//if
+				
+					if(dCollide(this->ODE_Geom_ID,RayZ, 1, &contact[0].geom, sizeof(dContact)))  {
+						if(dCollide(this->ODE_Geom_ID,RayZPos, 1, &contact[0].geom, sizeof(dContact)))  {
+						//	  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this, worldEntity, Vector(0.0f, 0.0f, 1.0f),
+                                                  //       Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+							
+						}//if
+						if(dCollide(this->ODE_Geom_ID,RayZNeg, 1, &contact[0].geom, sizeof(dContact)))  {
+							//  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z_NEG , this, worldEntity, Vector(0.0f, 0.0f, 1.0f),
+                                                         // Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
+							
+						}//if
+
+
+					}//if
+			
+			} //if
+		
+			
+      dGeomDestroy(RayX);
+      dGeomDestroy(RayY);
+      dGeomDestroy(RayZ);
+      dGeomDestroy(RayXPos);
+      dGeomDestroy(RayYPos);
+      dGeomDestroy(RayZPos);
+      dGeomDestroy(RayXNeg);
+      dGeomDestroy(RayYNeg);
+      dGeomDestroy(RayZNeg);
+	
+     dGeomDestroy(BBOX);
+} // if(bbox != 0)
+
+}
Index: branches/ODE/src/world_entities/terrain.h
===================================================================
--- branches/ODE/src/world_entities/terrain.h	(revision 9918)
+++ branches/ODE/src/world_entities/terrain.h	(revision 9919)
@@ -12,4 +12,5 @@
 
 #include "world_entity.h"
+#include  <ode/ode.h>
 
 // FORWARD DECLARATION
@@ -26,5 +27,5 @@
 {
   ObjectListDeclaration(Terrain);
-
+ 
  public:
   Terrain(const TiXmlElement* root = NULL);
@@ -32,4 +33,8 @@
   Terrain(DebugTerrain debugTerrain);
   virtual ~Terrain();
+
+  void go();
+  void checkCollisionTerrain(WorldEntity* worldEntity); /*!< WorldEntities use this function to check wheter they collided with the BspEntity.
+                                                      If a collision has been detected, the collides-function of worldEntity will be called.*/
 
   void init();
@@ -53,8 +58,16 @@
    Model*              vegetation;
    int                 modelList;
-
+   bool loaded;
    HeightMap*          heightMap;
    Material*           heightMapMaterial;
    Vector              terrainScale;
+   unsigned int*       Ind;
+
+   dTriMeshDataID   ODE_Geometry; //!< ODE Geometry Data of the static model
+   dGeomID          ODE_Geom_ID; //!< ID of ODE Geometry Data
+   dWorldID world;
+   dSpaceID space;
+   dJointGroupID contactgroup;
+   dContact contact[300];
 };
 
