Index: trunk/src/lib/collision_reaction/collision_event.h
===================================================================
--- trunk/src/lib/collision_reaction/collision_event.h	(revision 8796)
+++ trunk/src/lib/collision_reaction/collision_event.h	(revision 8894)
@@ -9,7 +9,11 @@
 #include "vector.h"
 
+#include "cr_defs.h"
+
+
 class WorldEntity;
 class BoundingVolume;
 class Plane;
+
 
 
@@ -22,9 +26,9 @@
 
   /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */
-  inline void collide(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB)
-  { this->entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; }
+  inline void collide(int type, WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB)
+  { this->collisionType = type; this->entityA = entityA; this->entityB = entityB; this->bvA = bvA; this->bvB = bvB; }
   /** collides two WorldEntities @param entity world entity , @param ground ground plane, @param position position on the ground */
-  inline void collide(WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position)
-  { this->entityA = entity; this->entityB = groundEntity, this->groundNormal = normal; this->position = position; }
+  inline void collide(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall)
+  { this->collisionType = type; this->entityA = entity; this->entityB = groundEntity, this->groundNormal = normal; this->position = position; this->bInWall = bInWall; }
 
 
@@ -44,4 +48,11 @@
   inline Vector getCollisionPosition() { return this->position; }
 
+  /** @return the type of the collision */
+  inline int getType() { return this->collisionType; }
+
+  /** @return true if the entity is in the wall */
+  inline bool isInWall() { return this->bInWall; }
+
+
  private:
   WorldEntity*      entityA;                       //!< the collision body A
@@ -53,4 +64,7 @@
   Vector            groundNormal;                  //!< the ground plane with which it collides (only for bsp-model collisions
   Vector            position;                      //!< position of the collision on the ground plane
+
+  bool              bInWall;                       //!< true if is in wall
+  int               collisionType;                 //!< collision type
 };
 
Index: trunk/src/lib/collision_reaction/cr_defs.h
===================================================================
--- trunk/src/lib/collision_reaction/cr_defs.h	(revision 8796)
+++ trunk/src/lib/collision_reaction/cr_defs.h	(revision 8894)
@@ -28,4 +28,13 @@
 
 
+//!< the collision axis x collision event
+#define COLLISION_TYPE_AXIS_X   1
+//!< the collision axis y collision event
+#define COLLISION_TYPE_AXIS_Y   2
+//!< the collision axis z collision event
+#define COLLISION_TYPE_AXIS_Z   4
+//!< the collision is a obb collision
+#define COLLISION_TYPE_OBB      8
+
 
 #endif /* _NETWORK_MANAGER */
Index: trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc
===================================================================
--- trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc	(revision 8796)
+++ trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc	(revision 8894)
@@ -1,12 +1,12 @@
 /*
    orxonox - the future of 3D-vertical-scrollers
- 
+
    Copyright (C) 2004 orx
- 
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
- 
+
    ### File Specific:
    main-programmer: Patrick Boenzli
@@ -26,5 +26,9 @@
 #include <vector>
 
+#include "debug.h"
+
 #include "aabb.h"
+
+#include "cr_defs.h"
 
 using namespace std;
@@ -64,15 +68,63 @@
   //   collision->getEntityB()->getAbsCoor().debug();
 
-  Vector height;
+  float height;
   AABB* box = collision->getEntityB()->getModelAABB();
-  
-  
-  
-  if(box!=NULL)
+  WorldEntity* entity = collision->getEntityB();
+
+  // collision position maths
+  Vector collPos =  collision->getEntityB()->getAbsCoor()  + box->center - ce->getCollisionPosition();
+
+  float CR_MAX_WALK_HEIGHT = 2.0f;
+  float CR_THRESHOLD = 0.2f;
+
+  if( box == NULL)
+  {
+    PRINTF(2)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n");
+    return;
+  }
+
+
+  switch( ce->getType())
+  {
+    case COLLISION_TYPE_AXIS_Y:
+
+      height = collPos.y - box->halfLength[1];
+     // PRINTF(0)("height: %f          , model height: %f\n", height, box->halfLength[1]);
+     // PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z);
+
+      // object is beneath the plane (ground)
+      if( height <= 0.0f )
+      {
+        entity->shiftCoor(Vector(0, -height, 0));
+      }
+      // object is already in the wall
+      else if( ce->isInWall())
+      {
+        entity->setAbsCoor(entity->getLastAbsCoor());
+      }
+      break;
+
+
+    case COLLISION_TYPE_AXIS_X:
+    case COLLISION_TYPE_AXIS_Z:
+      break;
+
+    }
+
+
+
+
+
+
+
+
+#if 0
+  if( box != NULL)
     height = ( ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor() )*(-1.0f) ;
   else
     height = ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor() ;
 
-  if(box!=NULL) {
+
+  if( box != NULL) {
 
 
@@ -90,6 +142,6 @@
       return;
     }
-    
-    
+
+
     if(ce->getGroundNormal().len() >= 1.4f) {
       downspeed++;
@@ -101,5 +153,5 @@
     if(height.y > box->halfLength[1] + 0.0f ) // Above ground
     {
-      if(height.y < box->halfLength[1] + 1.3f) // Snap in
+      if(height.y < box->halfLength[1] + 2.3f) // Snap in
       {
         downspeed = 0;
@@ -116,5 +168,5 @@
       {
         //if(downspeed <= 0) downspeed =1;
-        collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0, -height.y  +  box->halfLength[1] + 2.0f/* 0.00001 *//*height.y+3.500005 + 10.0*/,0.0));
+        collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0, -height.y  +  box->halfLength[1] + 2.0f,0.0));
         //collision->getEntityB()->setVelocity(Vector(0.0,0.0,0.0));
         downspeed = 0;
@@ -124,4 +176,5 @@
 
   }// if(box!= NULL)
+#endif
   /*
   PRINTF(0)("Collision with Ground: \n");
@@ -131,4 +184,5 @@
 
   */
+
 }
 
@@ -141,9 +195,5 @@
 void CRPhysicsGroundWalk::update(WorldEntity* owner)
 {
-  for( int i = 9; i > 0; i--) {
-    this->lastPositions[i] = this->lastPositions[i-1];
-    //     PRINTF(0)("lastPosition[%i]: %f, %f, %f\n", i, lastPositions[i].x, lastPositions[i].y, lastPositions[i].z);
-  }
-  this->lastPositions[0] = owner->getAbsCoor();
+
 }
 
Index: trunk/src/lib/collision_reaction/cr_physics_ground_walk.h
===================================================================
--- trunk/src/lib/collision_reaction/cr_physics_ground_walk.h	(revision 8796)
+++ trunk/src/lib/collision_reaction/cr_physics_ground_walk.h	(revision 8894)
@@ -23,10 +23,6 @@
     virtual void update(WorldEntity* entity);
 
+
   private:
-    Vector       lastPosition;                //!< vector with the last valid position
-    Vector       afterLastPosition;           //!< vector for the after last
-    Quaternion   lastDirection;               //!< quat with the last valid direction
-
-    Vector       lastPositions[10];           //!< last 10 positions
     float        downspeed;
 };
