Index: /trunk/README
===================================================================
--- /trunk/README	(revision 10012)
+++ /trunk/README	(revision 10013)
@@ -1,2 +1,3 @@
+
 
 This is the offical README file for the game project
Index: /trunk/src/lib/collision_detection/aabb_tree_node.cc
===================================================================
--- /trunk/src/lib/collision_detection/aabb_tree_node.cc	(revision 10012)
+++ /trunk/src/lib/collision_detection/aabb_tree_node.cc	(revision 10013)
@@ -17,6 +17,7 @@
 #include "aabb_tree_node.h"
 #include "aabb.h"
-
 #include "bv_tree.h"
+
+#include "collision_tube.h"
 
 #include "matrix.h"
@@ -532,5 +533,5 @@
         (treeNode->nodeRight == NULL && treeNode->nodeLeft == NULL)) )
     {
-      nodeA->registerCollision(nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement);
+      CoRe::CollisionTube::getInstance()->registerCollisionEvent( nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement);
     }
 
Index: /trunk/src/lib/collision_detection/obb_tree_node.cc
===================================================================
--- /trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 10012)
+++ /trunk/src/lib/collision_detection/obb_tree_node.cc	(revision 10013)
@@ -18,4 +18,6 @@
 #include "obb_tree.h"
 #include "obb.h"
+
+#include "collision_tube.h"
 
 #include "matrix.h"
@@ -477,4 +479,8 @@
     return;
 
+#warning this should be done
+//   if( !CoRe::CollisionTube::getInstance()->isReactive( *nodeA, *nodeB) )
+//     return;
+
 //   float distanceMax = this->bvElement->radius + ((OBBTreeNode*)treeNode)->bvElement->radius;
 //   float distance = fabs((nodeA->getAbsCoor() - nodeB->getAbsCoor()).len());
@@ -566,6 +572,6 @@
         (treeNode->nodeRight == NULL && treeNode->nodeLeft == NULL)) )
     {
-//       PRINTF(0)("----------------------------------------------\n\n\n\n\n\n--------------------------------\n\n\n");
-      nodeA->registerCollision(nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement);
+      //PRINTF(0)("----------------------------------------------\n\n\n\n\n\n--------------------------------\n\n\n");
+      CoRe::CollisionTube::getInstance()->registerCollisionEvent( nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement);
     }
 
Index: /trunk/src/lib/collision_reaction/Makefile.am
===================================================================
--- /trunk/src/lib/collision_reaction/Makefile.am	(revision 10012)
+++ /trunk/src/lib/collision_reaction/Makefile.am	(revision 10013)
@@ -5,7 +5,8 @@
 
 libORXcr_a_SOURCES = cr_engine.cc \
+                     collision_tube.cc \
                      collision.cc \
                      collision_event.cc \
-                     collision_handle.cc \
+                     collision_filter.cc \
                      collision_reaction.cc \
                      cr_object_damage.cc \
@@ -16,7 +17,8 @@
 
 noinst_HEADERS =     cr_engine.h \
+                     collision_tube.h \
                      collision.h \
                      collision_event.h \
-                     collision_handle.h \
+                     collision_filter.h \
                      cr_defs.h \
                      collision_reaction.h \
Index: /trunk/src/lib/collision_reaction/collision.cc
===================================================================
--- /trunk/src/lib/collision_reaction/collision.cc	(revision 10012)
+++ /trunk/src/lib/collision_reaction/collision.cc	(revision 10013)
@@ -19,35 +19,36 @@
 #include "debug.h"
 
-/**
- *  standard constructor
- */
-Collision::Collision ()
+namespace CoRe
 {
-  this->flushCollisionEvents();
-}
+
+  /**
+   *  standard constructor
+   */
+  Collision::Collision ()
+  {
+    this->reset();
+  }
 
 
-/**
- *  standard deconstructor
- */
-Collision::~Collision ()
-{
-}
+  /**
+   *  standard deconstructor
+   */
+  Collision::~Collision ()
+  {}
 
 
-/**
- * flushes the CollisionEvent list
- */
-void Collision::flushCollisionEvents()
-{
-  this->entityA = NULL;
-  this->entityB = NULL;
+  /**
+   * resets all variable states to initial values
+   */
+  void Collision::reset()
+  {
+    this->_entityA = NULL;
+    this->_entityB = NULL;
 
-  this->entityACollide = false;
-  this->entityBCollide = false;
+    this->_entityACollide = false;
+    this->_entityBCollide = false;
 
-  this->bDispatched = true;
+    this->_collisionEvents.clear();
+  }
 
-  this->collisionEvents.clear();
 }
-
Index: /trunk/src/lib/collision_reaction/collision.h
===================================================================
--- /trunk/src/lib/collision_reaction/collision.h	(revision 10012)
+++ /trunk/src/lib/collision_reaction/collision.h	(revision 10013)
@@ -1,9 +1,13 @@
 /*!
  * @file collision.h
- *  Definition of a collision as a two WE hit each other
+ *  Definition of a collision relation of two WorldEntities
  *
- *  A is shared between two WorldEntity's CollisionHandles if both are subscribed to this event. In this case only one
+ *  Is shared between two WorldEntity's CollisionHandles if both are subscribed to this event. In this case only one
  *  of the two CollisionHandles will calculate the CollisionReaction and the bDispatched flag will be set afterwards
  *  to signal that it's already cared about and should be ignored.
+ *
+ *  The collisions itself are saved in this container (CollisionEvent). Since there can be multiple collision events
+ *  for one collision. Imagine: two objects are intersecting (this throws a Collision): many collision boxes will fire
+ *  each of this boxes will "create" a CollisionEvent.
  */
 
@@ -14,57 +18,80 @@
 #include <vector>
 
+
+
 class WorldEntity;
 class BoundingVolume;
-class CollisionEvent;
 
-//! A class representing a simple collision
-class Collision
+namespace CoRe
 {
+
+  class CollisionEvent;
+
+  //! A class representing a simple collision
+  class Collision
+  {
+
+    typedef std::vector<CollisionEvent*>                  CollisionVector;  //!< the vector containing all collision events
+    typedef std::vector<CollisionEvent*>::iterator        Iterator;         //!< iterator definition
+    typedef std::vector<CollisionEvent*>::const_iterator  ConstIterator;   //!< constant iterator definition
+
+
   public:
+
     Collision();
     virtual ~Collision();
 
     /** 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) { this->entityA = entityA; this->entityB = entityB; this->bDispatched = false; }
+    inline void collide(WorldEntity* entityA, WorldEntity* entityB) { this->_entityA = entityA; this->_entityB = entityB; }
 
 
-    /** @return Collision WorldEntity A */
-    inline WorldEntity* getEntityA() const { return this->entityA; }
-    /** @return Collision WorldEntity B */
-    inline WorldEntity* getEntityB() const { return this->entityB; }
-    /** @return true if Entity A collides */
-    inline bool isEntityACollide() const { return this->entityACollide; }
-    /** sets the flag if it reacts @param flag true if it should react on entityA*/
-    inline void setEntityACollide(bool flag) { this->entityACollide = flag; }
-    /** @return true if Entity B collides */
-    inline bool isEntityBCollide() const { return this->entityBCollide; }
-    /** sets the flag if it reacts @param flag true if it should react on entityB*/
-    inline void setEntityBCollide(bool flag) { this->entityACollide = flag; }
+    /* list stuff */
+  public:
+
+    /** registers a @param event CollisionEvent to take place */
+    inline void registerCollisionEvent(CollisionEvent* event) { this->_collisionEvents.push_back(event); }
+
+    void reset();
 
 
-    /** @returns true if this Collision has already been dispatched */
-    inline bool isDispatched() { return this->bDispatched; }
-    /** sets the dispatched flag to true */
-    inline void dispatched() { this->bDispatched = true; }
-
-    /** registers a @param event CollisionEvent to take place */
-    inline void registerCollisionEvent(CollisionEvent* event) { this->collisionEvents.push_back(event); this->bDispatched = false;}
-    /** @returns a vector of collision events */
-    inline const std::vector<CollisionEvent*>& getCollisionEvents() const { return this->collisionEvents; }
+    /** @returns iterator pointing to the beginning of the collision event vector */
+    inline Iterator       begin()        { return this->_collisionEvents.begin(); }
+    /** @returns const iterator pointing to the beginning of the collision event vector */
+    inline ConstIterator  begin() const  { return this->_collisionEvents.begin(); }
+    /** @returns iterator pointing to the end of the collision event vector */
+    inline Iterator       end()          { return this->_collisionEvents.end(); }
+    /** @returns const iterator pointing to the end of the collision event vector */
+    inline ConstIterator  end() const    { return this->_collisionEvents.end(); }
 
 
-    void flushCollisionEvents();
+    /* misc interface functions */
+  public:
+    /** @return Collision WorldEntity A */
+    inline WorldEntity* getEntityA() const { return this->_entityA; }
+    /** @return Collision WorldEntity B */
+    inline WorldEntity* getEntityB() const { return this->_entityB; }
+    inline bool same(const WorldEntity& entityA, WorldEntity& entityB) const {
+      return ((this->_entityA == &entityA && this->_entityB == &entityB) || (this->_entityA == &entityB && this->_entityB == &entityA)); }
+
+    /** @return true if Entity A collides */
+    inline bool isEntityACollide() const { return this->_entityACollide; }
+    /** sets the flag if it reacts @param flag true if it should react on entityA*/
+    inline void setEntityACollide(bool flag) { this->_entityACollide = flag; }
+    /** @return true if Entity B collides */
+    inline bool isEntityBCollide() const { return this->_entityBCollide; }
+    /** sets the flag if it reacts @param flag true if it should react on entityB*/
+    inline void setEntityBCollide(bool flag) { this->_entityBCollide = flag; }
 
 
   private:
-    WorldEntity*                 entityA;                       //!< the collision body A
-    WorldEntity*                 entityB;                       //!< the collision body B
-    bool                         entityACollide;                //!< true if entity A is subscribed for collision reaction
-    bool                         entityBCollide;                //!< true if entity B is subscribed for collision reaction
+    WorldEntity*                 _entityA;                       //!< the collision body A
+    WorldEntity*                 _entityB;                       //!< the collision body B
+    bool                         _entityACollide;                //!< true if entity A is subscribed for collision reaction
+    bool                         _entityBCollide;                //!< true if entity B is subscribed for collision reaction
 
-    bool                         bDispatched;                   //!< true if this collision has already been dispatched
+    CollisionVector              _collisionEvents;               //!< the collision event list
 
-    std::vector<CollisionEvent*> collisionEvents;               //!< the collision event list
-};
+  };
+}
 
 #endif /* _COLLISION_H */
Index: /trunk/src/lib/collision_reaction/collision_event.cc
===================================================================
--- /trunk/src/lib/collision_reaction/collision_event.cc	(revision 10012)
+++ /trunk/src/lib/collision_reaction/collision_event.cc	(revision 10013)
@@ -19,23 +19,25 @@
 #include "debug.h"
 
-/**
- *  standard constructor
- */
-CollisionEvent::CollisionEvent ()
+namespace CoRe
 {
-  this->entityA = NULL;
-  this->entityB = NULL;
-  this->bvA = NULL;
-  this->bvB = NULL;
+
+  /**
+   *  standard constructor
+   */
+  CollisionEvent::CollisionEvent ()
+  {
+    this->entityA = NULL;
+    this->entityB = NULL;
+    this->bvA = NULL;
+    this->bvB = NULL;
+  }
+
+
+  /**
+   *  standard deconstructor
+   */
+  CollisionEvent::~CollisionEvent ()
+  {}
+
 }
 
-
-/**
- *  standard deconstructor
- */
-CollisionEvent::~CollisionEvent ()
-{
-}
-
-
-
Index: /trunk/src/lib/collision_reaction/collision_event.h
===================================================================
--- /trunk/src/lib/collision_reaction/collision_event.h	(revision 10012)
+++ /trunk/src/lib/collision_reaction/collision_event.h	(revision 10013)
@@ -2,4 +2,10 @@
  * @file collision_event.h
  *  Definition of a collision event
+ *
+ *  A collision event represents a collision of two bouning boxes. Every CollisionEvent belongs to a Collision object that
+ *  represents the collision of two WorldEntities.
+ *
+ *  There are different types of collisions: obb collisions and bsp collisions. Both collision types use different techniques
+ *  to represent collisions. This is why this class saves bounding boxes from the OBB as well as the planes from BSP.
  */
 
@@ -8,4 +14,5 @@
 
 #include "vector.h"
+#include "cr_engine.h"
 
 #include "cr_defs.h"
@@ -16,55 +23,65 @@
 class Plane;
 
+namespace CoRe
+{
+
+  //! A class representing a simple collision
+  class CollisionEvent
+  {
+  public:
+    CollisionEvent();
+    virtual ~CollisionEvent();
+
+    /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */
+    inline void collide(CREngine::CollisionType 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(CREngine::CollisionType 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;
+    }
 
 
-//! A class representing a simple collision
-class CollisionEvent {
- public:
-   CollisionEvent();
-  virtual ~CollisionEvent();
+    /** @return CollisionEvent WorldEntity A */
+    inline const WorldEntity* getEntityA() const  { return this->entityA; }
+    /** @return CollisionEvent WorldEntity B */
+    inline const WorldEntity* getEntityB() const  { return this->entityB; }
+    /** @return Bounding Volume from EntityA */
+    inline const BoundingVolume* getBVA() const { return this->bvA; }
+    /** @return Bounding Volume from EntityB */
+    inline const BoundingVolume* getBVB() const {  return this->bvB;  }
 
-  /** collides two WorldEntities @param entityA world entity A, @param entityB world entity B, @param bvA volume A @param bvB volumeB */
-  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(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; }
+    /** @return ground plane if collided with bsp model */
+    inline const Vector& getGroundNormal() const  { return this->groundNormal; }
+
+    /** @return position of the position, only accurate if this is a collision with the ground!!! */
+    inline const Vector& getCollisionPosition() const  {  return this->position;  }
+
+    /** @return the type of the collision */
+    inline int getType() const  {  return this->collisionType;  }
+
+    /** @return true if the entity is in the wall */
+    inline bool isInWall() const  {  return this->bInWall;  }
 
 
-  /** @return CollisionEvent WorldEntity A */
-  inline WorldEntity* getEntityA() const { return this->entityA; }
-  /** @return CollisionEvent WorldEntity B */
-  inline WorldEntity* getEntityB() const { return this->entityB; }
-  /** @return Bounding Volume from EntityA */
-  inline BoundingVolume* getBVA() const { return this->bvA; }
-  /** @return Bounding Volume from EntityB */
-  inline BoundingVolume* getBVB() const { return this->bvB; }
+  private:
+    WorldEntity*      entityA;                       //!< the collision body A
+    WorldEntity*      entityB;                       //!< the collision body B
 
-  /** @return ground plane if collided with bsp model */
-  inline Vector getGroundNormal() { return this->groundNormal; }
+    BoundingVolume*   bvA;                           //!< reference to the bounding volume A
+    BoundingVolume*   bvB;                           //!< reference to the bounding volume B
 
-  /** @return position of the position, only accurate if this is a collision with the ground!!! */
-  inline Vector getCollisionPosition() { return this->position; }
+    Vector            groundNormal;                  //!< the ground plane with which it collides (only for bsp-model collisions
+    Vector            position;                      //!< position of the collision on the ground plane
 
-  /** @return the type of the collision */
-  inline int getType() { return this->collisionType; }
+    bool              bInWall;                       //!< true if is in wall
+    int               collisionType;                 //!< collision type
+  };
 
-  /** @return true if the entity is in the wall */
-  inline bool isInWall() { return this->bInWall; }
-
-
- private:
-  WorldEntity*      entityA;                       //!< the collision body A
-  WorldEntity*      entityB;                       //!< the collision body B
-
-  BoundingVolume*   bvA;                           //!< reference to the bounding volume A
-  BoundingVolume*   bvB;                           //!< reference to the bounding volume B
-
-  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
-};
-
+}
 #endif /* _COLLISION_EVENT_H */
Index: /trunk/src/lib/collision_reaction/collision_filter.cc
===================================================================
--- /trunk/src/lib/collision_reaction/collision_filter.cc	(revision 10013)
+++ /trunk/src/lib/collision_reaction/collision_filter.cc	(revision 10013)
@@ -0,0 +1,200 @@
+/*
+   orxonox - the future of 3D-vertical-scrollersf
+
+   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
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION_REACTION
+
+#include "collision_filter.h"
+
+#include "world_entity.h"
+
+#include "collision.h"
+#include "collision_event.h"
+
+
+#include "debug.h"
+
+#include <vector>
+
+
+namespace CoRe
+{
+
+  ObjectListDefinition(CollisionFilter);
+
+  /**
+   * standard constructor
+   * @todo this constructor is not jet implemented - do it
+  */
+  CollisionFilter::CollisionFilter (WorldEntity* owner)
+  {
+    this->registerObject(this, CollisionFilter::_objectList);
+
+    this->_owner = owner;
+
+    this->_bContinuousPoll = false;
+    this->_bStopOnFirstCollision = false;
+    this->_bReactive = false;
+  }
+
+
+  /**
+   * standard deconstructor
+  */
+  CollisionFilter::~CollisionFilter ()
+  {
+    this->unsubscribeReactions();
+  }
+
+
+  /**
+   * subscribe reaction
+   */
+  void CollisionFilter::subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1)
+  {
+    // check if its a valid type
+    if( likely(this->validCRType( type)))
+    {
+      //check if this class isn't already registered
+      TargetIterator it = this->_filters[type].begin();
+      for(; it != this->_filters[type].end(); it++)
+      {
+        if( unlikely(*it == target1))
+          return;
+      }
+
+      // so subscribe the reaction finally
+      this->_filters[type].push_back(target1);
+      this->_bReactive = true;
+    }
+  }
+
+
+  /**
+   * subscribe for a reaction
+   */
+  void CollisionFilter::subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2)
+  {
+    this->subscribeReaction(type, target1);
+    this->subscribeReaction(type, target2);
+  }
+
+
+  /**
+   * subscribe for a reaction
+   */
+  void CollisionFilter::subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2, const ClassID& target3)
+  {
+    this->subscribeReaction(type, target1);
+    this->subscribeReaction(type, target2);
+    this->subscribeReaction(type, target3);
+  }
+
+  /**
+   * unsubscribe from a specific collision reaction
+   */
+  void CollisionFilter::unsubscribeReaction(CoRe::CREngine::ReactionType type)
+  {
+    if( likely(this->validCRType( type)))
+      this->_filters[type].clear();
+
+    for( int i = 0; i < CREngine::CR_NUMBER; i++)
+    {
+      if( this->_filters[i].size() > 0)
+      {
+        this->_bReactive = true;
+        break;
+      }
+    }
+
+  }
+
+  /**
+   * unsubscribe from all collision reactions
+   */
+  void CollisionFilter::unsubscribeReactions()
+  {
+    for(int i = 0; i < CREngine::CR_NUMBER; i++)
+      this->_filters[i].clear();
+
+    this->_bReactive = false;
+  }
+
+
+
+  /**
+   * tests if the owner WorldEntity is listening to collisions from another specif WorldEntity entity
+   *  @param entity WorldEntity to test against
+   *
+   * This is the most important interface function of this class: it performs a check and returns true
+   * if the WorldEntity entity is actualy responsive for a certain other WorldEntity
+   */
+  bool CollisionFilter::operator()(const WorldEntity& entity) const
+  {
+//     PRINTF(0)("operator()(const WorldEntity& entity)\n");
+
+    // if there are no installed criterions just ommit and return
+    if( !this->isReactive())
+      return false;
+
+    // goes through all registered filter criterions and looks for matches
+    for( int i = 0; i < CREngine::CR_NUMBER; i++ )
+    {
+      TargetIteratorConst it = this->_filters[i].begin();
+      for(; it != this->_filters[i].end(); it++ )
+      {
+//          PRINTF(0)("[%i] check %s is a %s?\n", i, entity.getClassName().c_str(), (*it).name().c_str());
+        if( unlikely(entity.isA(*it) ) )
+          return true;
+      }
+    }
+
+    return false;
+  }
+
+
+  /**
+  * tests if the owner WorldEntity is listening to collisions from another specif WorldEntity entity
+  *  @param entity WorldEntity to test against
+  *
+  * This is the most important interface function of this class: it performs a check and returns true
+  * if the WorldEntity entity is actualy responsive for a certain other WorldEntity
+   */
+  bool CollisionFilter::operator()(const WorldEntity& entity, const CREngine::ReactionType type) const
+  {
+    assert(&entity != NULL);
+
+//     PRINTF(0)("operator()(const WorldEntity& entity, const CREngine::ReactionType type)\n");
+    // if there are no installed criterions just omit and return
+    if( !this->isReactive())
+      return false;
+
+
+    // goes through all registered filter criterions and looks for matches
+    TargetIteratorConst it = this->_filters[type].begin();
+    for(; it != this->_filters[type].end(); it++ )
+    {
+//        PRINTF(0)("size: %i - %s is a %s?\n", this->_filters[type].size(), entity.getClassName().c_str(), (*it).name().c_str());
+      if( entity.isA(*it))
+        return true;
+    }
+
+    return false;
+  }
+
+
+
+} // namespace end
+
+
+
Index: /trunk/src/lib/collision_reaction/collision_filter.h
===================================================================
--- /trunk/src/lib/collision_reaction/collision_filter.h	(revision 10013)
+++ /trunk/src/lib/collision_reaction/collision_filter.h	(revision 10013)
@@ -0,0 +1,93 @@
+/*!
+ * @file collision_filter.h
+ * @brief Definition of a collision filter: checks if a certain WorldEntity is responsive for another WorldEntity
+ *
+*/
+
+#ifndef _COLLISION_FILTER_H
+#define _COLLISION_FILTER_H
+
+#include "base_object.h"
+#include "cr_engine.h"
+
+#include <vector>
+#include <list>
+
+
+class Collision;
+class WorldEntity;
+
+namespace CoRe
+{
+
+  class CollisionReaction;
+
+
+  /**
+   * A class for defining collision reactions and storing events (functional object)
+   *
+   * This class basically checks if the owner of this filter (a WorldEntity) is responsive for a certain other WorldEntity.
+   * The check is performed via the operator() (therefore it's a functional objects). For each CollisionReaction there is a list
+   * of WorldEntities (their ClassIDs) to which it listens to.
+   */
+  class CollisionFilter : public BaseObject
+  {
+    ObjectListDeclaration(CollisionFilter);
+
+
+    typedef std::vector<ClassID>::iterator        TargetIterator;
+    typedef std::vector<ClassID>::const_iterator  TargetIteratorConst;
+
+    /* Constructor/Deconstructors */
+  public:
+    CollisionFilter(WorldEntity* owner);
+    virtual ~CollisionFilter();
+
+  private:
+    CollisionFilter(const CollisionFilter& collisionFilter) {}
+    WorldEntity*                  _owner;                   //!< the worldenity this reaction will be applied on
+
+
+  public:
+    /* Defines Operators */
+    bool operator()(const WorldEntity& entity) const;
+    bool operator()(const WorldEntity& entity, const CREngine::ReactionType type) const;
+
+
+    /* Collision Reaction subscription unsubscription Block */
+  public:
+    void subscribeReaction(CREngine::ReactionType type, const ClassID& target1);
+    void subscribeReaction(CREngine::ReactionType type, const ClassID& target1, const ClassID& target2);
+    void subscribeReaction(CREngine::ReactionType type, const ClassID& target1, const ClassID& target2, const ClassID& target3);
+
+    void unsubscribeReaction(CREngine::ReactionType type);
+    void unsubscribeReactions();
+
+  private:
+    std::vector<ClassID>          _filters[CREngine::CR_NUMBER];  //!< an array of filter targets: for each collision type a list of filter objects
+
+
+    /* Misc State Informations */
+  public:
+    /** @returns true if this handle should be pulled also if there are no collisions, can also be set with this function (reference)*/
+    inline bool isContinousPoll() { return this->_bContinuousPoll; }
+    /** @returns true if this filter should be pulled always */
+    inline bool isContinousPoll() const { return this->_bContinuousPoll; }
+    /** @returns true if this filter is reactive i.e. at least one filter criterion installed */
+    inline bool isReactive() const { return this->_bReactive; }
+
+
+  private:
+    /** @returns true if this @param type Collision Reaction type is a valid number */
+    inline bool validCRType(const CREngine::ReactionType& type) const {return (type >= 0 && type < CREngine::CR_NUMBER); }
+
+
+  private:
+    bool                          _bContinuousPoll;         //!< if this is true
+    bool                          _bStopOnFirstCollision;   //!< true if the cd of this object should be terminated after one match
+    bool                          _bReactive;               //!< true if this class has at least one filter criterion == one target
+
+  };
+
+}
+#endif /* _COLLISION_FILTER_H */
Index: unk/src/lib/collision_reaction/collision_handle.cc
===================================================================
--- /trunk/src/lib/collision_reaction/collision_handle.cc	(revision 10012)
+++ 	(revision )
@@ -1,319 +1,0 @@
-/*
-   orxonox - the future of 3D-vertical-scrollersf
-
-   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
-*/
-
-#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION_REACTION
-
-#include "collision_handle.h"
-
-#include "world_entity.h"
-
-#include "collision.h"
-#include "collision_event.h"
-#include "collision_reaction.h"
-
-#include "cr_object_damage.h"
-#include "cr_physics_ground_walk.h"
-#include "cr_physics_full_walk.h"
-
-#include "debug.h"
-
-
-ObjectListDefinition(CollisionHandle);
-
-/**
- * standard constructor
- * @todo this constructor is not jet implemented - do it
-*/
-CollisionHandle::CollisionHandle (WorldEntity* owner, CREngine::CRType type)
-{
-  this->registerObject(this, CollisionHandle::_objectList);
-
-  this->owner = owner;
-  this->type = type;
-
-  this->bCollided = false;
-  this->bDispatched = true;
-
-  this->collisionReaction = NULL;
-  this->bContinuousPoll = false;
-  this->bStopOnFirstCollision = false;
-
-
-  switch( type)
-  {
-    case CREngine::CR_PHYSICS_FULL_WALK:
-      this->collisionReaction = new CRPhysicsFullWalk();
-      this->bContinuousPoll = true;
-      break;
-    case CREngine::CR_PHYSICS_GROUND_WALK:
-      this->collisionReaction = new CRPhysicsGroundWalk();
-      this->bContinuousPoll = true;
-      break;
-    case CREngine::CR_OBJECT_DAMAGE:
-      this->collisionReaction = new CRObjectDamage();
-      this->bStopOnFirstCollision = true;
-      break;
-    default:
-      break;
-  };
-}
-
-
-/**
- * standard deconstructor
-*/
-CollisionHandle::~CollisionHandle ()
-{
-  // delete what has to be deleted here
-  if( this->collisionReaction != NULL)
-    delete this->collisionReaction;
-}
-
-/**
- * restores the CollisionHandle to its initial state
- */
-void CollisionHandle::reset()
-{
-  this->flushCollisions();
-}
-
-
-/**
- * add more filter targets to this collision handle
- *  @param classID the classid to look for
- */
-void CollisionHandle::addTarget(const ClassID& target)
-{
-  // make sure there is no dublicate
-  std::vector<ClassID>::iterator it = this->targetList.begin();
-  for( ; it < this->targetList.end(); it++)
-    if( (*it) == target)
-      return;
-
-
-  // add element
-  this->targetList.push_back(target);
-   PRINTF(5)("addTarget: %i \n", target.id());
-}
-
-
-/**
- * registers a new Collision Object
- *  @param entityA WorldEntity A of the collision
- *  @param entityB WorldEntity B of the collision
- * if a there is already a collision object with the same stats
- * registration will be skipped and the last collision object is returned
- */
-Collision* CollisionHandle::registerCollision(WorldEntity* entityA, WorldEntity* entityB)
-{
-  //first get the collision object, multiple sources
-  Collision* c;
-  if( this->collisionList.empty() ||
-      ((this->collisionList.back())->getEntityA() != entityA && (this->collisionList.back())->getEntityB() != entityB )) {
-    c = CREngine::getInstance()->popCollisionObject();
-    c->collide(entityA, entityB);
-    this->collisionList.push_back(c);
-
-    // now register it as a shared collision with the other collision entity
-    CollisionHandle* ch = entityB->getCollisionHandle(this->type);
-    if( ch != NULL)
-      ch->registerSharedCollision(c);
-  }
-  else
-    c = this->collisionList.back();
-
-  return c;
-}
-
-
-/**
- * register a Collision to the Collision handle.
- *  @param collision the collision object to register
- *
- * This is used for internal collision registration: sharing the collision objects between Collision Reactions
- * Therefore dispatching it only once
- */
-void CollisionHandle::registerSharedCollision(Collision* collision)
-{
-  // fist check if we are listening for this Collision
-  if( !this->filterCollision(collision))
-    return;
-
-  // set the state to not dispatched
-  this->bDispatched = false;
-  this->bCollided = true;
-  collision->setEntityBCollide(true);
-
-  this->collisionList.push_back(collision);
-}
-
-
-/**
- * this is the function to be called on a collision event for this handle
- *  @param collision the collision objects containing all collision informations
- */
-void CollisionHandle::registerCollisionEvent(CollisionEvent* collisionEvent)
-{
-  if( !this->filterCollisionEvent(collisionEvent))
-    return;
-
-  // set the state to not dispatched
-  this->bDispatched = false;
-  this->bCollided = true;
-
-  // checks if these WorldEntities have already collided or if its a new collision -> create a new Collision object
- Collision* c = this->registerCollision(collisionEvent->getEntityA(), collisionEvent->getEntityB());
- c->setEntityACollide(true);
-
- c->registerCollisionEvent(collisionEvent);
- PRINTF(5)("Registering Collision Event: %s, %s\n", collisionEvent->getEntityA()->getClassCName(), collisionEvent->getEntityB()->getClassCName());
-}
-
-
-/**
- * flushes the collision list
- */
-void CollisionHandle::flushCollisions()
-{
-  this->collisionList.clear();
-}
-
-
-/**
- * handles the collisions and react according to algorithm
- */
-void CollisionHandle::handleCollisions()
-{
-  // if continuous poll poll the reaction
-  if( this->bContinuousPoll && !this->bCollided)
-  {
-    this->collisionReaction->update(this->owner);
-    return;
-  }
-
-  // collision reaction calculations (for every collision there will be a reaction)
-  std::vector<Collision*>::iterator it = this->collisionList.begin();
-  for(; it < this->collisionList.end(); it++) {
-    if( !(*it)->isDispatched())
-    {
-      this->collisionReaction->reactToCollision(*it);
-      (*it)->flushCollisionEvents();
-    }
-  }
-
-  // now set state to dispatched
-  this->bDispatched = true;
-  this->bCollided = false;
-
-  this->flushCollisions();
-}
-
-
-/**
- * filter out the CollisionEvents that are not wanted
- *  @param collisionEvent the collision event to filter
- */
-bool CollisionHandle::filterCollisionEvent(CollisionEvent* collisionEvent)
-{
-  std::vector<ClassID>::iterator it = this->targetList.begin();
-  for(; it < this->targetList.end(); it++)
-  {
-//     if(collisionEvent->getEntityB()->isA(CL_AIMING_SYSTEM) || collisionEvent->getEntityA()->isA(CL_AIMING_SYSTEM))
-//     {
-//        PRINTF(0)("I am: %s colliding with: %s\n", owner->getClassCName(), collisionEvent->getEntityB()->getClassCName(), *it);
-//        if( collisionEvent->getEntityA() == this->owner) {
-//          PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassCName(),
-//          collisionEvent->getEntityB()->getClassCName(), *it);
-//          if( collisionEvent->getEntityB()->isA((ClassID)(*it))) {
-//            PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
-//            collisionEvent->getEntityB()->getClassCName(), *it);
-//             }
-//        }
-//        else {
-//          PRINTF(0)("I am not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassCName(),
-//          collisionEvent->getEntityB()->getClassCName(), *it);
-//          if( collisionEvent->getEntityA()->isA((ClassID)(*it))) {
-//            PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
-//            collisionEvent->getEntityA()->getClassCName(), *it);
-//             }
-//        }
-//
-//     }
-
-    if( collisionEvent->getEntityA() == this->owner) {
-      if( collisionEvent->getEntityB()->isA((*it))) {
-        PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
-	collisionEvent->getEntityB()->getClassCName(), (*it).id());
-        return true; }
-    }
-    else {
-      if( collisionEvent->getEntityA()->isA((*it))) {
-        PRINTF(5)("I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
-	collisionEvent->getEntityA()->getClassCName(), (*it).id());
-      return true; }
-    }
-  }
-
-  return false;
-}
-
-
-/**
- * filter Collisions that are not wanted to be reacted to
- *  @param collision the collision object to filter
- */
-bool CollisionHandle::filterCollision(Collision* collision)
-{
-  std::vector<ClassID>::iterator it = this->targetList.begin();
-  for(; it < this->targetList.end(); it++)
-  {
-
-//     if(collision->getEntityB()->isA(CL_AIMING_SYSTEM) || collision->getEntityA()->isA(CL_AIMING_SYSTEM))
-//     {
-//       PRINTF(0)("Shared!!! I am: %s colliding with: %s\n", owner->getClassCName(), collision->getEntityB()->getClassCName(), *it);
-//       if( collision->getEntityA() == this->owner) {
-//         PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassCName(),
-//         collision->getEntityB()->getClassCName(), *it);
-//         if( collision->getEntityB()->isA((ClassID)(*it))) {
-//           PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
-//           collision->getEntityB()->getClassCName(), *it);
-//         }
-//       }
-//       else {
-//         PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassCName(),
-//         collision->getEntityB()->getClassCName(), *it);
-//         if( collision->getEntityA()->isA((ClassID)(*it))) {
-//           PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassCName(),
-//           collision->getEntityA()->getClassCName(), *it);
-//         }
-//       }
-//     }
-
-    if( collision->getEntityA() == this->owner) {
-      if( collision->getEntityA()->isA(*it))
-        return true; }
-      else {
-        if( collision->getEntityB()->isA(*it))
-          return true; }
-  }
-
-  return false;
-}
-
-
-
-
-
-
-
Index: unk/src/lib/collision_reaction/collision_handle.h
===================================================================
--- /trunk/src/lib/collision_reaction/collision_handle.h	(revision 10012)
+++ 	(revision )
@@ -1,73 +1,0 @@
-/*!
- * @file collision_handle.h
- * @brief Definition of a collision handle: used for accesing per world entity collision events and reactions
-*/
-
-#ifndef _COLLISION_HANDLE_H
-#define _COLLISION_HANDLE_H
-
-#include "base_object.h"
-#include "cr_engine.h"
-
-#include <vector>
-#include <list>
-
-
-class Collision;
-class WorldEntity;
-class CollisionReaction;
-
-
-
-//! A class for defining collision reactions and storing events
-class CollisionHandle : public BaseObject
-{
-  ObjectListDeclaration(CollisionHandle);
-  public:
-    CollisionHandle(WorldEntity* owner, CREngine::CRType type);
-    virtual ~CollisionHandle();
-
-    void reset();
-
-    void addTarget(const ClassID& target);
-    Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB);
-    void registerSharedCollision(Collision* collision);
-    void registerCollisionEvent(CollisionEvent* collisionEvent);
-
-    /** @returns true if regiestered some new collision events in this tick frame */
-    inline bool isCollided() const { return this->bCollided; }
-    /** @returns true if this collision handle has already been dispatched */
-    inline bool isDispatched() const { return this->bDispatched; }
-    /** @returns true if this handle should be pulled also if there are no collisions */
-    inline bool isContinuousPoll() const { return this->bContinuousPoll; }
-    /** @returns the type */
-    inline CREngine::CRType getType() const { return this->type; }
-
-    void handleCollisions();
-
-
-  private:
-    void flushCollisions();
-    bool filterCollisionEvent(CollisionEvent* collisionEvent);
-    bool filterCollision(Collision* collision);
-
-
-
-  private:
-    WorldEntity*                  owner;                   //!< the worldenity this reaction will be applied on
-    CREngine::CRType              type;                    //!< the reaction type
-
-    bool                          bContinuousPoll;         //!< if this is true
-    bool                          bDispatched;             //!< true if this handle has already been dispatched
-    bool                          bStopOnFirstCollision;   //!< true if the cd of this object should be terminated after one match
-    bool                          bCollided;               //!< true if the CollsionHandle has registered some new collisions
-
-    std::vector<Collision*>       collisionList;           //!< a list full of collisions
-    /// TODO Take a std::set here!
-    std::vector<ClassID>          targetList;              //!< a list of target classes for filtering @TODO TAKE SET INSTEAD OF VECTOR HERE
-
-    CollisionReaction*            collisionReaction;       //!< reference to the collision reaction object
-
-};
-
-#endif /* _COLLISION_HANDLE_H */
Index: /trunk/src/lib/collision_reaction/collision_reaction.cc
===================================================================
--- /trunk/src/lib/collision_reaction/collision_reaction.cc	(revision 10012)
+++ /trunk/src/lib/collision_reaction/collision_reaction.cc	(revision 10013)
@@ -11,5 +11,4 @@
    ### File Specific:
    main-programmer: Patrick Boenzli
-   co-programmer: ...
 */
 
@@ -18,23 +17,24 @@
 #include "collision_reaction.h"
 
+namespace CoRe
+{
+
+  ObjectListDefinition(CollisionReaction);
+
+  /**
+   *  standard constructor
+   */
+  CollisionReaction::CollisionReaction ()
+      : BaseObject()
+  {
+    this->registerObject(this, CollisionReaction::_objectList);
+  }
 
 
-ObjectListDefinition(CollisionReaction);
+  /**
+   *  standard deconstructor
+   */
+  CollisionReaction::~CollisionReaction ()
+  {}
 
-/**
- *  standard constructor
- */
-CollisionReaction::CollisionReaction ()
-  : BaseObject()
-{
-  this->registerObject(this, CollisionReaction::_objectList);
 }
-
-
-/**
- *  standard deconstructor
- */
-CollisionReaction::~CollisionReaction ()
-{
-}
-
Index: /trunk/src/lib/collision_reaction/collision_reaction.h
===================================================================
--- /trunk/src/lib/collision_reaction/collision_reaction.h	(revision 10012)
+++ /trunk/src/lib/collision_reaction/collision_reaction.h	(revision 10013)
@@ -9,14 +9,15 @@
 #include "base_object.h"
 
-
-
-class Collision;
 class WorldEntity;
 
+namespace CoRe
+{
 
-//! A class representing a simple collision
-class CollisionReaction : public BaseObject
-{
-  ObjectListDeclaration(CollisionReaction);
+  class Collision;
+
+  //! A class representing a simple collision
+  class CollisionReaction : public BaseObject
+  {
+    ObjectListDeclaration(CollisionReaction);
   public:
     CollisionReaction();
@@ -25,6 +26,4 @@
     virtual void reactToCollision(Collision* collision) = 0;
 
-    virtual void update(WorldEntity* owner) {}
-
     /** use this to do some collision offline calculations, only called for bContinuousPoll == true */
     inline bool isContinuousPoll() const { return this->bContinuousPoll; }
@@ -32,5 +31,6 @@
   private:
     bool                    bContinuousPoll;       //!< if true the collision rection function is also called, if there was no collision
-};
+  };
 
+}
 #endif /* _COLLISION_REACTION_H */
Index: /trunk/src/lib/collision_reaction/collision_tube.cc
===================================================================
--- /trunk/src/lib/collision_reaction/collision_tube.cc	(revision 10013)
+++ /trunk/src/lib/collision_reaction/collision_tube.cc	(revision 10013)
@@ -0,0 +1,140 @@
+/*
+   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
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION_REACTION
+
+#include "collision_tube.h"
+
+#include "world_entity.h"
+
+#include "collision.h"
+#include "collision_event.h"
+#include "collision_reaction.h"
+
+#include "cr_object_damage.h"
+#include "cr_physics_ground_walk.h"
+#include "cr_physics_full_walk.h"
+
+#include "debug.h"
+
+
+namespace CoRe
+{
+
+  ObjectListDefinition(CollisionTube);
+
+  CollisionTube* CollisionTube::singletonRef = NULL;
+
+
+  /**
+   * standard constructor
+   * @todo this constructor is not jet implemented - do it
+   */
+  CollisionTube::CollisionTube ()
+  {
+    this->registerObject(this, CollisionTube::_objectList);
+  }
+
+
+  /**
+   * standard deconstructor
+   */
+  CollisionTube::~CollisionTube ()
+  {
+    this->reset();
+  }
+
+
+
+  /**
+   * resets the collision tube after each collision detection cycle
+   */
+  void CollisionTube::reset()
+  {
+    this->_collisionList.clear();
+  }
+
+
+  /**
+   * gets the collision object useable for collision events registarations
+   * @param entityA collision partner 1
+   * @param entityB collision partner 2
+   * @return the collision object to be used
+   */
+  Collision* CollisionTube::registerCollision(WorldEntity* entityA, WorldEntity* entityB)
+  {
+    assert( entityA != NULL && entityB != NULL);
+
+    Collision* collision = NULL;
+    if( !this->_collisionList.empty())
+      collision = this->_collisionList.back();
+
+    // check if there is already a collision defined between these objects or this is the first collision at all
+    if( collision == NULL || !collision->same(*entityA, *entityB))
+    {
+      collision = CREngine::getInstance()->popCollisionObject();
+      collision->collide( entityA, entityB);
+      this->_collisionList.push_back(collision);
+    }
+
+    return collision;
+  }
+
+
+  /**
+   * registers a new CollisionEvent
+   * @param entityA one collision object
+   * @param entityB the other collision objectName
+   * @param bvA bounding volume of object A
+   * @param bvB bounding volume of object B
+   *
+   * this function doesn't check if the entities in question actualy are registered for any collisions
+   */
+  void CollisionTube::registerCollisionEvent(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB)
+  {
+    // first get a useable collision object
+    Collision* collision = this->registerCollision(entityA, entityB);
+
+    // now register the new collision event
+    CollisionEvent* collisionEvent = CREngine::getInstance()->popCollisionEventObject();
+    collisionEvent->collide( CREngine::CR_COLLISION_TYPE_OBB, entityA, entityB, bvA, bvB);
+    collision->registerCollisionEvent( collisionEvent);
+  }
+
+
+  /**
+   * registers a new CollisionEvent, only used by ground to object collision (eg. bsp model)
+   * @param type type of collision as stated in cr_def.h
+   * @param entity the WorldEntity colliding with the ground
+   * @param groundEntity the WorldEntity representing the ground
+   * @param normal the normal vector for the ground (up) - not always specified
+   * @param position the position of the collision relative to the object center
+   * @param bInWall true if the entity is in the ground material
+   */
+  void CollisionTube::registerCollisionEvent(CREngine::CollisionType type, WorldEntity* entity, WorldEntity* groundEntity,
+      const Vector& normal, const Vector& position, bool bInWall)
+  {
+    // first get a useable collision object
+    Collision* collision = this->registerCollision(entity, groundEntity);
+
+    // now register the new collision event
+    CollisionEvent* collisionEvent = CREngine::getInstance()->popCollisionEventObject();
+    collisionEvent->collide( type, entity, groundEntity, normal, position, bInWall);
+    collision->registerCollisionEvent( collisionEvent);
+  }
+
+
+
+}// namespace end
+
Index: /trunk/src/lib/collision_reaction/collision_tube.h
===================================================================
--- /trunk/src/lib/collision_reaction/collision_tube.h	(revision 10013)
+++ /trunk/src/lib/collision_reaction/collision_tube.h	(revision 10013)
@@ -0,0 +1,96 @@
+/*!
+ * @file collision_tube.h
+ *
+ * collision tube collects all collisions from all entities
+ *
+ *  The collision events are saved in the _collisionList vector in a fixed hirarchy: a collision is defined by the world entities
+ *  that collide. For each collision there is an entry in _collisionList. Each collision itself again contains collision events which are
+ *  defined as collisions between the boundibg volumes (BV) of the world entities. This could look like this:
+ *
+ *  - Collision (WorldEntity_i  <=> WorldEntity_j)
+ *     +- CollisionEvent( some BV <=> some other BV)
+ *     +- CollisionEvent( some BV <=> some other BV)
+ *  - Collision (WorldEntity_k <=> WorldEntity_l)
+ *     +- CollisionEvent( some BV <=> some other BV)
+ *     +- CollisionEvent( some BV <=> some other BV)
+ *     +- CollisionEvent( some BV <=> some other BV)
+ *     +- CollisionEvent( some BV <=> some other BV)
+ *  - ... etc ...
+ *
+ *
+ *  When the collisions are processed by the handleCollision() function each collision pair is checked for their reactions (since each
+ *  WorldEntity can define several reactions to a collision). After all the reactions are calculated and applied the collision object is
+ *  put back.
+ */
+
+#ifndef _COLLISION_TUBE_H
+#define _COLLISION_TUBE_H
+
+#include "base_object.h"
+#include "cr_engine.h"
+#include "world_entity.h"
+
+#include "vector.h"
+#include <vector>
+
+class Collision;
+class WorldEntity;
+class BoundingVolume;
+
+namespace CoRe
+{
+
+  class CollisionReaction;
+
+  //! A class containing all CollisionEvents (structured as defined in the file doxygen tags)
+  class CollisionTube : public BaseObject
+  {
+    ObjectListDeclaration(CollisionTube);
+
+    typedef std::vector<Collision*>::iterator     CollisionIterator;
+    typedef std::vector<Collision*>               CollisionVector;
+
+
+    /* Constructor/Deconstructor/Singleton Interface */
+  public:
+    inline static CollisionTube* getInstance() { if( !singletonRef) singletonRef = new CollisionTube(); return singletonRef; }
+
+    virtual ~CollisionTube();
+
+  private:
+    CollisionTube();
+    CollisionTube(const CollisionTube& tube) {}
+
+    static CollisionTube*          singletonRef;                         //!< the singleton instance
+
+
+    /* Collision Handling */
+  public:
+    void registerCollisionEvent(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB);
+    void registerCollisionEvent(CREngine::CollisionType type, WorldEntity* entity, WorldEntity* groundEntity,
+                                const Vector& normal, const Vector& position, bool bInWall = false);
+    Collision* registerCollision(WorldEntity* entityA, WorldEntity* entityB);
+
+    void reset();
+
+    /** @returns an iterator pointing to the beginning of the list */
+    CollisionIterator begin() { return this->_collisionList.begin(); }
+    /** @returns an iterator pointing to the end of the list */
+    CollisionIterator end()   { return this->_collisionList.end(); }
+
+
+  private:
+    CollisionVector             _collisionList;                      //!< the list of collisions since the last processing
+
+
+    /* Misc State Informations */
+  public:
+    /** @returns true if at least one of both WorldEntities are subscribed for a collision reaction */
+    inline bool isReactive(const WorldEntity& entityA, const WorldEntity& entityB) const
+      { return (entityA.isReactive(entityB) && entityB.isReactive(entityA)); }
+
+  };
+
+}
+
+#endif /* _COLLISION_TUBE_H */
Index: /trunk/src/lib/collision_reaction/cr_defs.h
===================================================================
--- /trunk/src/lib/collision_reaction/cr_defs.h	(revision 10012)
+++ /trunk/src/lib/collision_reaction/cr_defs.h	(revision 10013)
@@ -28,16 +28,4 @@
 
 
-//!< the collision axis x collision event
-#define COLLISION_TYPE_AXIS_X      1
-#define COLLISION_TYPE_AXIS_X_NEG  2
-//!< the collision axis y collision event
-#define COLLISION_TYPE_AXIS_Y      3
-#define COLLISION_TYPE_AXIS_Y_NEG  4
-//!< the collision axis z collision event
-#define COLLISION_TYPE_AXIS_Z      5
-#define COLLISION_TYPE_AXIS_Z_NEG  6
-//!< the collision is a obb collision
-#define COLLISION_TYPE_OBB      8
 
-
-#endif /* _NETWORK_MANAGER */
+#endif /* _CR_DEFS_H */
Index: /trunk/src/lib/collision_reaction/cr_engine.cc
===================================================================
--- /trunk/src/lib/collision_reaction/cr_engine.cc	(revision 10012)
+++ /trunk/src/lib/collision_reaction/cr_engine.cc	(revision 10013)
@@ -17,8 +17,12 @@
 
 
+#include "cr_object_damage.h"
+#include "cr_physics_full_walk.h"
+#include "cr_physics_ground_walk.h"
 
 #include "collision.h"
 #include "collision_event.h"
-#include "collision_handle.h"
+#include "collision_filter.h"
+#include "collision_tube.h"
 #include "cr_defs.h"
 
@@ -27,152 +31,184 @@
 #include "debug.h"
 
-
-
-ObjectListDefinition(CREngine);
-/**
- * standard constructor
- */
-CREngine::CREngine ()
-  : BaseObject()
+namespace CoRe
 {
-  this->registerObject(this, CREngine::_objectList);
-   this->setName("CREngine");
-
-   this->init();
+
+  ObjectListDefinition(CREngine);
+
+
+  /**
+   * standard constructor
+   */
+  CREngine::CREngine ()
+      : BaseObject()
+  {
+    this->registerObject(this, CREngine::_objectList);
+    this->setName("CREngine");
+
+    this->init();
+  }
+
+  /**
+   *  the singleton reference to this class
+   */
+  CREngine* CREngine::singletonRef = NULL;
+
+  /**
+     @brief standard deconstructor
+   */
+  CREngine::~CREngine ()
+  {
+    CREngine::singletonRef = NULL;
+
+    if( this->collisionsUnused.size() != CR_MAX_COLLISIONS)
+      PRINTF(0)("CollisionReaction Error: Collision cache size missmatch: %i of %i\n", this->collisionsUnused.size(), CR_MAX_COLLISIONS);
+    if( this->collisionEventsUnused.size() != CR_MAX_COLLISION_EVENTS)
+      PRINTF(0)("CollisionReaction Error: CollisionEvent cache size missmatch: %i of %i\n", this->collisionEventsUnused.size(), CR_MAX_COLLISION_EVENTS);
+
+    this->reset();
+
+    CollisionIterator it1 = this->collisionsUnused.begin();
+    for(; it1 < this->collisionsUnused.end(); it1++)
+      delete *it1;
+    CollisionEventIterator it2 = this->collisionEventsUnused.begin();
+    for(; it2 < this->collisionEventsUnused.end(); it2++)
+      delete *it2;
+
+    this->collisionsUnused.clear();
+    this->collisionEventsUnused.clear();
+  }
+
+
+  /**
+   * inits the CREngine to a working state
+   */
+  void CREngine::init()
+  {
+    // precaching:
+    // create a list of Collisions and CollisionEvents for fast object recycling purposes
+    for( int i = 0; i < CR_MAX_COLLISIONS; i++)
+      this->collisionsUnused.push_back(new Collision());
+    for( int i = 0; i < CR_MAX_COLLISION_EVENTS; i++)
+      this->collisionEventsUnused.push_back(new CollisionEvent());
+
+
+    // push the collision reaction object on the list in the right order
+
+    // physical reactions
+    this->_reactionList[CREngine::CR_PHYSICS_MOMENTUM]      = NULL;
+    this->_reactionList[CREngine::CR_PHYSICS_STEP_BACK]     = NULL;
+    this->_reactionList[CREngine::CR_PHYSICS_GROUND_WALK]   = new CRPhysicsGroundWalk();
+    this->_reactionList[CREngine::CR_PHYSICS_FULL_WALK]     = new CRPhysicsFullWalk();
+    this->_reactionList[CREngine::CR_PHYSICS_DAMAGE]        = NULL;
+    // object based reactions
+    this->_reactionList[CREngine::CR_OBJECT_DAMAGE]         = new CRObjectDamage();
+    this->_reactionList[CREngine::CR_OBJECT_PICKUP]         = NULL;
+    // misc reactions
+    this->_reactionList[CREngine::CR_VERTEX_TRAFO]          = NULL;
+    this->_reactionList[CREngine::CR_SPECIAL_CALLBACK]      = NULL;
+  }
+
+
+  /**
+   * @returns an instance to a collision object. instead of creating new object this ones can be resycled
+   */
+  Collision* CREngine::popCollisionObject()
+  {
+    if( !this->collisionsUnused.empty())
+    {
+      this->collisionsUsed.push_back(this->collisionsUnused.back());
+      this->collisionsUnused.pop_back();
+      return this->collisionsUsed.back();
+    }
+    else
+    {
+      PRINTF(0)("There is no Collision Object left in the precache table, fatal error will cause segfault, change CR_MAX_COLLISIONS\n");
+      assert(false);
+      return NULL;
+    }
+  }
+
+
+  /**
+   * @return an instanco of a CollisionEvent object. instead of creating a new object this ones can be used and resycled
+   */
+  CollisionEvent* CREngine::popCollisionEventObject()
+  {
+    if( !this->collisionEventsUnused.empty())
+    {
+      this->collisionEventsUsed.push_back(this->collisionEventsUnused.back());
+      this->collisionEventsUnused.pop_back();
+      return this->collisionEventsUsed.back();
+    }
+    else
+    {
+      PRINTF(0)("There is no Collision Object left in the precache table, fatal error will cause segfault, change CR_MAX_COLLISION_EVENTS\n");
+      assert(false);
+      return NULL;
+    }
+  }
+
+
+  /**
+   * handles all collisions in registered in this tube
+   */
+  void CREngine::handleCollisions()
+  {
+    // for all collisions:
+    CollisionIterator ci = CollisionTube::getInstance()->begin();
+    for(; ci < CollisionTube::getInstance()->end(); ci++)
+    {
+      for( int i = CREngine::CR_PHYSICS_MOMENTUM; i < CREngine::CR_NUMBER; i++)
+      {
+        if( _reactionList[i] == NULL)
+          continue;
+
+//         PRINTF(0)("CR CHECK: collision between: %s, %s\n", (*ci)->getEntityA()->getClassName().c_str(), (*ci)->getEntityB()->getClassName().c_str());
+
+        // check if entity A or B is subscibed for this event
+        bool aReact = (*ci)->getEntityA()->isReactive(*(*ci)->getEntityB(), (CREngine::ReactionType)i);
+        bool bReact = (*ci)->getEntityB()->isReactive(*(*ci)->getEntityA(), (CREngine::ReactionType)i);
+
+        // store this information
+        (*ci)->setEntityACollide(aReact);
+        (*ci)->setEntityBCollide(bReact);
+
+        // and execute the reaction
+        if(  aReact || bReact)
+        {
+          this->_reactionList[i]->reactToCollision(*ci);
+          //PRINTF(0)("executing reaction: %s, between %s - %s\n", this->_reactionList[i]->getClassName().c_str(), (*ci)->getEntityA()->getClassName().c_str(), (*ci)->getEntityB()->getClassName().c_str());
+        }
+      }
+      (*ci)->reset();
+    }
+
+    this->reset();
+  }
+
+
+  /**
+   * flushes all the collision lists and puts them to their initial state
+   */
+  void CREngine::reset()
+  {
+    CollisionIterator it1 = this->collisionsUsed.begin();
+    for(; it1 < this->collisionsUsed.end(); it1++)
+      this->collisionsUnused.push_back(*it1);
+
+    CollisionEventIterator it2 = this->collisionEventsUsed.begin();
+    for(; it2 < this->collisionEventsUsed.end(); it2++)
+      this->collisionEventsUnused.push_back(*it2);
+
+    this->collisionsUsed.clear();
+    this->collisionEventsUsed.clear();
+
+    CollisionTube::getInstance()->reset();
+  }
+
+
+  void CREngine::debug()
+  {
+  }
+
 }
-
-/**
- *  the singleton reference to this class
- */
-CREngine* CREngine::singletonRef = NULL;
-
-/**
-   @brief standard deconstructor
- */
-CREngine::~CREngine ()
-{
-  CREngine::singletonRef = NULL;
-
-  if( this->collisionsUnused.size() != CR_MAX_COLLISIONS)
-    PRINTF(0)("CollisionReaction Error: Collision cache size missmatch: %i of %i\n", this->collisionsUnused.size(), CR_MAX_COLLISIONS);
-  if( this->collisionEventsUnused.size() != CR_MAX_COLLISION_EVENTS)
-    PRINTF(0)("CollisionReaction Error: CollisionEvent cache size missmatch: %i of %i\n", this->collisionEventsUnused.size(), CR_MAX_COLLISION_EVENTS);
-
-  this->reset();
-
-  std::vector<Collision*>::iterator it1 = this->collisionsUnused.begin();
-  for(; it1 < this->collisionsUnused.end(); it1++)
-    delete *it1;
-  std::vector<CollisionEvent*>::iterator it2 = this->collisionEventsUnused.begin();
-  for(; it2 < this->collisionEventsUnused.end(); it2++)
-    delete *it2;
-
-  this->collisionsUnused.clear();
-  this->collisionEventsUnused.clear();
-}
-
-/**
- * inits the CREngine to a working state
- */
-void CREngine::init()
-{
-  // create a list of Collision events (precaching)
-  for( int i = 0; i < CR_MAX_COLLISIONS; i++)
-    this->collisionsUnused.push_back(new Collision());
-  for( int i = 0; i < CR_MAX_COLLISION_EVENTS; i++)
-    this->collisionEventsUnused.push_back(new CollisionEvent());
-}
-
-
-/**
- * flushes the CollisionHandles and restores the CREngine to the initial state
- */
-void CREngine::reset()
-{
-  // first clear all CollisionHandles
-
-  std::vector<CollisionHandle*>::iterator it = this->collisionHandles.begin();
-  for(; it < this->collisionHandles.end(); it++)
-  {
-    (*it)->reset();
-    delete *it;
-  }
-
-  this->collisionHandles.clear();
-}
-
-
-/**
- * subscribes a WorldEntity for a CollisionReaction
- *  @param owner: the WE to subscribe
- *  @param type: the type of collision reaction to perform
- *  @return the newly created CollisionHandle
- */
-CollisionHandle* CREngine::subscribeReaction(WorldEntity* owner, CRType type)
-{
-  CollisionHandle* ch = new CollisionHandle(owner, type);
-  this->collisionHandles.push_back(ch);
-
-  return ch;
-}
-
-
-/**
- * unsubscribe reaction from the reaction list
- *  @param collisionHandle the CollisionHandle to remove
- *  @param returns true if worked collrectly
- */
-bool CREngine::unsubscribeReaction(CollisionHandle* collisionHandle)
-{
-  std::vector<CollisionHandle*>::iterator it;
-  for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)  {
-    if( *it == collisionHandle) {
-      this->collisionHandles.erase(it);
-      delete collisionHandle;
-      return true;
-    }
-  }
-  return false;
-}
-
-
-/**
- * processes the collisions by calling the EventHandlers
- */
-void CREngine::handleCollisions()
-{
-  std::vector<CollisionHandle*>::iterator it;
-  for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)
-  {
-    if( !(*it)->isDispatched() || (*it)->isContinuousPoll())  //does it have any collisions to report at all
-    {
-      (*it)->handleCollisions();
-    }
-  }
-  this->flushCollisions();
-}
-
-
-/**
- * flushes all the collision lists and puts them to their initial state
- */
-void CREngine::flushCollisions()
-{
-  std::vector<Collision*>::iterator it1 = this->collisionsUsed.begin();
-  for(; it1 < this->collisionsUsed.end(); it1++)
-    this->collisionsUnused.push_back(*it1);
-
-  std::vector<CollisionEvent*>::iterator it2 = this->collisionEventsUsed.begin();
-  for(; it2 < this->collisionEventsUsed.end(); it2++)
-    this->collisionEventsUnused.push_back(*it2);
-
-  this->collisionsUsed.clear();
-  this->collisionEventsUsed.clear();
-}
-
-
-void CREngine::debug()
-{
-
-}
-
Index: /trunk/src/lib/collision_reaction/cr_engine.h
===================================================================
--- /trunk/src/lib/collision_reaction/cr_engine.h	(revision 10012)
+++ /trunk/src/lib/collision_reaction/cr_engine.h	(revision 10013)
@@ -16,79 +16,90 @@
 #include <vector>
 
-// FORWARD DECLARATION
-class CollisionHandle;
-class Collision;
-class CollisionEvent;
 class WorldEntity;
 
-//! A default singleton class.
-class CREngine : public BaseObject
+
+namespace CoRe
 {
-  ObjectListDeclaration(CREngine);
+  class Collision;
+  class CollisionEvent;
+  class CollisionReaction;
+
+
+  //! A default singleton class.
+  class CREngine : public BaseObject
+  {
+    ObjectListDeclaration(CREngine);
+
+    typedef std::vector<CollisionEvent*>             CollisionEventVector;
+    typedef std::vector<Collision*>                  CollisionVector;
+    typedef std::vector<Collision*>::iterator        CollisionIterator;
+    typedef std::vector<CollisionEvent*>::iterator   CollisionEventIterator;
+
 
   public:
-  typedef enum CRType {
-    CR_PHYSICS_MOMENTUM   = 0,    //!< physical reaction: conservervation of momentum
-    CR_PHYSICS_STEP_BACK,         //!< physical reaction: just go to the last position without collisions
-    CR_PHYSICS_GROUND_WALK,       //!< physical reaction: stand on the ground, no movement: simulating simple normal force away from the gravity force
-    CR_PHYSICS_FULL_WALK,         //!< physical reaction: walking on the ground (inkl. hills etc)
-    CR_PHYSICS_DAMAGE,            //!< physical reaction: daling damage according to the object energy and their structural stability
+    typedef enum ReactionType {
+      CR_PHYSICS_MOMENTUM   = 0,           //!< physical reaction: conservervation of momentum
+      CR_PHYSICS_STEP_BACK,                //!< physical reaction: just go to the last position without collisions
+      CR_PHYSICS_GROUND_WALK,              //!< physical reaction: stand on the ground, no movement: simple normal force away from the gravity force
+      CR_PHYSICS_FULL_WALK,                //!< physical reaction: walking on the ground (inkl. hills etc)
+      CR_PHYSICS_DAMAGE,                   //!< physical reaction: daling damage according to the object energy and their structural stability
 
-    CR_OBJECT_DAMAGE,             //!< object raction: deals damage according to the objects specific damage potential (like weapons, nukes, etc.)
-    CR_OBJECT_PICKUP,             //!< object rection: calling the objects pickup functions, let them handle the collision (once!)
+      CR_OBJECT_DAMAGE,                    //!< object raction: deals damage according to the objects specific damage potential (like weapons, nukes, etc.)
+      CR_OBJECT_PICKUP,                    //!< object rection: calling the objects pickup functions, let them handle the collision (once!)
 
-    CR_VERTEX_TRAFO,              //!< vertex trafo: transforming the vertex according to the damage
+      CR_VERTEX_TRAFO,                     //!< vertex trafo: transforming the vertex according to the damage
 
-    CR_SPECIAL_CALLBACK,          //!< special: call a callback function
+      CR_SPECIAL_CALLBACK,                 //!< special: call a callback function
 
-    CR_NUMBER
+      CR_NUMBER
+    };
+
+    typedef enum CollisionType {
+      CR_COLLISION_TYPE_AXIS_X       = 0,  //!< collision on x axis
+      CR_COLLISION_TYPE_AXIS_X_NEG,        //!< collision on negative x axis
+      CR_COLLISION_TYPE_AXIS_Y,            //!< collision on y axis
+      CR_COLLISION_TYPE_AXIS_Y_NEG,        //!< collision on negative y axis
+      CR_COLLISION_TYPE_AXIS_Z,            //!< collision on z axis
+      CR_COLLISION_TYPE_AXIS_Z_NEG,        //!< collision on negative z axis
+      CR_COLLISION_TYPE_OBB,               //!< object aligned bounding box collide
+
+      CR_COLLISION_TYPE_NUMBER
+    };
+
+
+    virtual ~CREngine(void);
+
+    /** @returns a Pointer to the only object of this Class */
+    inline static CREngine* getInstance() { if (!singletonRef) singletonRef = new CREngine();  return singletonRef; };
+
+    Collision* popCollisionObject();
+    CollisionEvent* popCollisionEventObject();
+
+    void handleCollisions();
+
+    void debug();
+
+
+  private:
+    CREngine();
+    void init();
+
+    void reset();
+
+
+  private:
+    static CREngine*                    singletonRef;             //!< the reference to the CREngine object (singleton)
+
+    CollisionVector                     collisionsUsed;           //!< a list of used, cached collisions
+    CollisionVector                     collisionsUnused;         //!< a list of unused, cached collisions
+
+    CollisionEventVector                collisionEventsUsed;      //!< a list of used, cached collision events
+    CollisionEventVector                collisionEventsUnused;    //!< a list of unused, cached collision events
+
+    CollisionReaction*                  _reactionList[CREngine::CR_NUMBER];  //!< the collision reaction list containing all reactions types
+
+
   };
 
-  virtual ~CREngine(void);
-
-  /** @returns a Pointer to the only object of this Class */
-  inline static CREngine* getInstance() { if (!singletonRef) singletonRef = new CREngine();  return singletonRef; };
-
-  void reset();
-
-
-  CollisionHandle* subscribeReaction(WorldEntity* worldEntity, CRType type);
-
-  bool unsubscribeReaction(CollisionHandle* collisionHandle);
-
-  void handleCollisions();
-
-  /** @returns an instance to a collision object. instead of creating new object this ones can be resycled */
-  inline Collision* popCollisionObject() {
-    if( !this->collisionsUnused.empty()) {
-      this->collisionsUsed.push_back(this->collisionsUnused.back()); this->collisionsUnused.pop_back(); return this->collisionsUsed.back(); } else return NULL; }
-
-
-  /** @return an instanco of a CollisionEvent object. instead of creating a new object this ones can be used and resycled */
-  inline CollisionEvent* popCollisionEventObject() {
-    if( !this->collisionEventsUnused.empty()) {
-      this->collisionEventsUsed.push_back(this->collisionEventsUnused.back()); this->collisionEventsUnused.pop_back(); return this->collisionEventsUsed.back(); } else return NULL; }
-
-  void debug();
-
-
-private:
-  CREngine();
-  void init();
-
-  void flushCollisions();
-
-
-private:
-  std::vector<CollisionHandle*>       collisionHandles;         //!< list with the collision handles
-
-  std::vector<Collision*>             collisionsUsed;           //!< a list of used, cached collisions
-  std::vector<Collision*>             collisionsUnused;         //!< a list of unused, cached collisions
-
-  std::vector<CollisionEvent*>        collisionEventsUsed;      //!< a list of used, cached collision events
-  std::vector<CollisionEvent*>        collisionEventsUnused;    //!< a list of unused, cached collision events
-
-  static CREngine*                    singletonRef;             //!< the reference to the CREngine object (singleton)
-};
-
+}
 #endif /* _CR_ENGINE_ */
Index: /trunk/src/lib/collision_reaction/cr_object_damage.cc
===================================================================
--- /trunk/src/lib/collision_reaction/cr_object_damage.cc	(revision 10012)
+++ /trunk/src/lib/collision_reaction/cr_object_damage.cc	(revision 10013)
@@ -26,61 +26,61 @@
 #include "debug.h"
 
+namespace CoRe
+{
+
+  ObjectListDefinition(CRObjectDamage);
+  /**
+   *  standard constructor
+   */
+  CRObjectDamage::CRObjectDamage ()
+      : CollisionReaction()
+  {
+    this->registerObject(this, CRObjectDamage::_objectList);
+  }
 
 
-ObjectListDefinition(CRObjectDamage);
-/**
- *  standard constructor
- */
-CRObjectDamage::CRObjectDamage ()
-  : CollisionReaction()
-{
-  this->registerObject(this, CRObjectDamage::_objectList);
-}
+  /**
+   *  standard deconstructor
+   */
+  CRObjectDamage::~CRObjectDamage ()
+  {}
 
 
-/**
- *  standard deconstructor
- */
-CRObjectDamage::~CRObjectDamage ()
-{
-}
+  /**
+   * caluculates and applys the reaction to a specific collision
+   *  @param collision the collision
+   */
+  void CRObjectDamage::reactToCollision(Collision* collision)
+  {
+    float damage = 0.0f;
 
+    PRINTF(0)("Dealing damage - Handling collision: %s vs %s\n",
+              collision->getEntityA()->getClassCName(),
+              collision->getEntityB()->getClassCName());
 
-/**
- * caluculates and applys the reaction to a specific collision
- *  @param collision the collision
- */
-void CRObjectDamage::reactToCollision(Collision* collision)
-{
-  float damage = 0.0f;
+    // the collision damage been dealed by the entity
+    if( collision->isEntityACollide())
+    {
+      damage = collision->getEntityB()->getDamage();
+      collision->getEntityA()->hit(damage, collision->getEntityB());
+      PRINTF(0)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassCName());
+    }
 
-  PRINTF(4)("Dealing damage - Handling collision: %s vs %s\n",
-            collision->getEntityA()->getClassCName(),
-            collision->getEntityB()->getClassCName());
+    if( collision->isEntityBCollide())
+    {
+      damage = collision->getEntityA()->getDamage();
+      collision->getEntityB()->hit(damage, collision->getEntityA());
+      PRINTF(0)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassCName());
+    }
 
-  // the collision damage been dealed by the entity
-  if( collision->isEntityACollide()) {
-    damage = collision->getEntityB()->getDamage();
-    collision->getEntityA()->hit(damage, collision->getEntityB());
-    PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassCName());
+    //   const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
+    //   std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
+    //   for(; it != collisionEvents->end(); it++)
+    //   {
+    //     // go through the collisions and try to estimate the damage
+    //     mass = (*it)->getEntityA()->getMass();
+    //   }
+
   }
 
-  if( collision->isEntityBCollide()) {
-    damage = collision->getEntityA()->getDamage();
-    collision->getEntityB()->hit(damage, collision->getEntityA());
-    PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassCName());
-  }
-
-  collision->flushCollisionEvents();
-  collision->dispatched();
-
-//   const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
-//   std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
-//   for(; it != collisionEvents->end(); it++)
-//   {
-//     // go through the collisions and try to estimate the damage
-//     mass = (*it)->getEntityA()->getMass();
-//   }
-
 }
-
Index: /trunk/src/lib/collision_reaction/cr_object_damage.h
===================================================================
--- /trunk/src/lib/collision_reaction/cr_object_damage.h	(revision 10012)
+++ /trunk/src/lib/collision_reaction/cr_object_damage.h	(revision 10013)
@@ -7,13 +7,17 @@
 #define _CR_OBJECT_DAMAGE_H
 
+
 #include "collision_reaction.h"
 
 
-class Collision;
+namespace CoRe
+{
 
-//! A class representing a reaction to a collision: dealing damage to an object
-class CRObjectDamage : public CollisionReaction
-{
-  ObjectListDeclaration(CRObjectDamage);
+  class Collision;
+
+  //! A class representing a reaction to a collision: dealing damage to an object
+  class CRObjectDamage : public CollisionReaction
+  {
+    ObjectListDeclaration(CRObjectDamage);
   public:
     CRObjectDamage();
@@ -22,7 +26,6 @@
     virtual void reactToCollision(Collision* collision);
 
-  private:
-
-};
+  };
+}
 
 #endif /* _CR_OBJECT_DAMAGE_H */
Index: /trunk/src/lib/collision_reaction/cr_physics_full_walk.cc
===================================================================
--- /trunk/src/lib/collision_reaction/cr_physics_full_walk.cc	(revision 10012)
+++ /trunk/src/lib/collision_reaction/cr_physics_full_walk.cc	(revision 10013)
@@ -33,196 +33,184 @@
 #include "cr_defs.h"
 
-
-
-ObjectListDefinition(CRPhysicsFullWalk);
-/**
- *  standard constructor
- */
-CRPhysicsFullWalk::CRPhysicsFullWalk ()
-    : CollisionReaction()
+namespace CoRe
 {
-  this->registerObject(this, CRPhysicsFullWalk::_objectList);
+
+  ObjectListDefinition(CRPhysicsFullWalk);
+  /**
+   *  standard constructor
+   */
+  CRPhysicsFullWalk::CRPhysicsFullWalk ()
+      : CollisionReaction()
+  {
+    this->registerObject(this, CRPhysicsFullWalk::_objectList);
+  }
+
+
+  /**
+   *  standard deconstructor
+   */
+  CRPhysicsFullWalk::~CRPhysicsFullWalk ()
+  {}
+
+
+  /**
+   * caluculates and applys the reaction to a specific collision
+   *  @param collision the collision
+   */
+  void CRPhysicsFullWalk::reactToCollision(Collision* collision)
+  {
+
+    AABB* box = collision->getEntityA()->getModelAABB();
+    WorldEntity* entity = collision->getEntityA();
+
+    if( box == NULL)
+    {
+      PRINTF(2)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n");
+      return;
+    }
+
+
+    float CR_MAX_WALK_HEIGHT = 15.0f;
+//    float CR_THRESHOLD = 0.2f;
+
+    float height = 0.0f;
+    float front = 0.0f;
+    float back = 0.0f;
+    float right = 0.0f;
+    float left = 0.0f;
+
+
+    std::vector<CollisionEvent*>::const_iterator it = collision->begin();
+    for(; it != collision->end(); it++)
+    {
+
+      CollisionEvent* ce = (*it);
+      Vector normal = ce->getGroundNormal();
+
+      // calculate the collision position
+      Vector collPos =  collision->getEntityA()->getAbsCoor()  + box->center - ce->getCollisionPosition();
+
+      // test the 3 axis differently
+      switch( ce->getType())
+      {
+          /* collision in the X-AXIS */
+        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X:
+          front = collPos.len() - box->halfLength[0];
+
+          // object is beneath the plane (ground)
+          if( front <= 0.0f )
+          {
+            Vector dirX = entity->getAbsDirX();
+            dirX.y = 0.0f;
+            dirX.normalize();
+            Vector backoff = dirX * front;
+
+            entity->shiftCoor(backoff);
+          }
+          else if( ce->isInWall())
+          {
+            // object is already in the wall
+            entity->setAbsCoor(entity->getLastAbsCoor());
+          }
+          break;
+
+        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X_NEG:
+          back = collPos.len() - box->halfLength[0];
+
+          // object is beneath the plane (ground)
+          if( back <= 0.0f)
+          {
+            Vector dirX = entity->getAbsDirX();
+            dirX.y = 0.0f;
+            dirX.normalize();
+            Vector backoff = dirX * back * -1.0f;
+
+            entity->shiftCoor(backoff);
+          }
+          else if( ce->isInWall())
+          {
+            // object is already in the wall
+            entity->setAbsCoor(entity->getLastAbsCoor());
+          }
+          break;
+
+
+          /* collision in the Y-AXIS */
+        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG:
+          // calulate the height above ground
+          height = collPos.len() - box->halfLength[1];
+
+
+          // object is beneath the plane (ground)
+          //         if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
+          if( height < 0.0f && -height < CR_MAX_WALK_HEIGHT)
+          {
+            entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f));
+            entity->setOnGround(true);
+          }
+          // object is already in the wall
+          else if( ce->isInWall())
+          {
+            entity->setAbsCoor(entity->getLastAbsCoor());
+            PRINTF(0)("ground collision: reset pos\n");
+          }
+          else
+          {
+            // entity is not on ground
+            entity->setOnGround(false);
+          }
+          break;
+
+
+          /* collision in the Z-AXIS */
+        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z:
+
+          right = collPos.len()  - box->halfLength[2];
+
+          // object is beneath the plane (ground)
+          if( right <= 0.0f )
+          {
+            Vector dirZ = entity->getAbsDirZ();
+            dirZ.y = 0.0f;
+            dirZ.normalize();
+            Vector backoff = dirZ * right;
+            entity->shiftCoor(backoff);
+          }
+          else if( ce->isInWall())
+          {
+            // object is already in the wall
+            entity->setAbsCoor(entity->getLastAbsCoor());
+          }
+          break;
+
+
+          // collision in the z-axis
+        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z_NEG:
+
+          left = collPos.len()  - box->halfLength[2];
+
+          // object is beneath the plane (ground)
+          if( left <= 0.0f )
+          {
+            Vector dirZ = entity->getAbsDirZ();
+            dirZ.y = 0.0f;
+            dirZ.normalize();
+            Vector backoff = dirZ * left*-1.0f;
+            entity->shiftCoor(backoff);
+          }
+          // object is already in the wall
+          else if( ce->isInWall())
+          {
+            entity->setAbsCoor(entity->getLastAbsCoor());
+          }
+          break;
+      }
+    }
+    //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
+  }
+
+
+
+
 }
 
-
-/**
- *  standard deconstructor
- */
-CRPhysicsFullWalk::~CRPhysicsFullWalk ()
-{}
-
-
-/**
- * caluculates and applys the reaction to a specific collision
- *  @param collision the collision
- */
-void CRPhysicsFullWalk::reactToCollision(Collision* collision)
-{
-
-  AABB* box = collision->getEntityB()->getModelAABB();
-  WorldEntity* entity = collision->getEntityB();
-
-  if( box == NULL)
-  {
-    PRINTF(2)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n");
-    return;
-  }
-
-
-  float CR_MAX_WALK_HEIGHT = 15.0f;
-  float CR_THRESHOLD = 0.2f;
-
-  float height = 0.0f;
-  float front = 0.0f;
-  float back = 0.0f;
-  float right = 0.0f;
-  float left = 0.0f;
-
-
-  const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
-  std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
-  for(; it != collisionEvents->end(); it++)
-  {
-
-    CollisionEvent* ce = (*it);
-    Vector normal = ce->getGroundNormal();
-
-    // calculate the collision position
-    Vector collPos =  collision->getEntityB()->getAbsCoor()  + box->center - ce->getCollisionPosition();
-
-    // test the 3 axis differently
-    switch( ce->getType())
-    {
-        /* collision in the X-AXIS */
-      case COLLISION_TYPE_AXIS_X:
-        front = collPos.len() - box->halfLength[0];
-
-        // object is beneath the plane (ground)
-        if( front <= 0.0f )
-        {
-          Vector dirX = entity->getAbsDirX();
-          dirX.y = 0.0f;
-          dirX.normalize();
-          Vector backoff = dirX * front;
-
-          entity->shiftCoor(backoff);
-        }
-        else if( ce->isInWall())
-        {
-          // object is already in the wall
-          entity->setAbsCoor(entity->getLastAbsCoor());
-        }
-        break;
-
-      case COLLISION_TYPE_AXIS_X_NEG:
-        back = collPos.len() - box->halfLength[0];
-
-        // object is beneath the plane (ground)
-        if( back <= 0.0f)
-        {
-          Vector dirX = entity->getAbsDirX();
-          dirX.y = 0.0f;
-          dirX.normalize();
-          Vector backoff = dirX * back * -1.0f;
-
-          entity->shiftCoor(backoff);
-        }
-        else if( ce->isInWall())
-        {
-          // object is already in the wall
-          entity->setAbsCoor(entity->getLastAbsCoor());
-        }
-        break;
-
-
-        /* collision in the Y-AXIS */
-      case COLLISION_TYPE_AXIS_Y_NEG:
-        // calulate the height above ground
-        height = collPos.len() - box->halfLength[1];
-
-
-        // object is beneath the plane (ground)
-        //         if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
-        if( height < 0.0f && -height < CR_MAX_WALK_HEIGHT)
-        {
-          entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f));
-          entity->setOnGround(true);
-        }
-        // object is already in the wall
-        else if( ce->isInWall())
-        {
-          entity->setAbsCoor(entity->getLastAbsCoor());
-          PRINTF(0)("ground collision: reset pos\n");
-        }
-        else
-        {
-          // entity is not on ground
-          entity->setOnGround(false);
-        }
-        break;
-
-
-        /* collision in the Z-AXIS */
-      case COLLISION_TYPE_AXIS_Z:
-
-        right = collPos.len()  - box->halfLength[2];
-
-        // object is beneath the plane (ground)
-        if( right <= 0.0f )
-        {
-          Vector dirZ = entity->getAbsDirZ();
-          dirZ.y = 0.0f;
-          dirZ.normalize();
-          Vector backoff = dirZ * right;
-          entity->shiftCoor(backoff);
-        }
-        else if( ce->isInWall())
-        {
-          // object is already in the wall
-          entity->setAbsCoor(entity->getLastAbsCoor());
-        }
-        break;
-
-
-        // collision in the z-axis
-      case COLLISION_TYPE_AXIS_Z_NEG:
-
-        left = collPos.len()  - box->halfLength[2];
-
-        // object is beneath the plane (ground)
-        if( left <= 0.0f )
-        {
-          Vector dirZ = entity->getAbsDirZ();
-          dirZ.y = 0.0f;
-          dirZ.normalize();
-          Vector backoff = dirZ * left*-1.0f;
-          entity->shiftCoor(backoff);
-        }
-        // object is already in the wall
-        else if( ce->isInWall())
-        {
-          entity->setAbsCoor(entity->getLastAbsCoor());
-        }
-        break;
-    }
-  }
-  //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
-
-
-
-
-
-
-
-}
-
-
-
-
-/**
- * use this to do some collision offline calculations, only called for bContinuousPoll == true
- */
-void CRPhysicsFullWalk::update(WorldEntity* owner)
-{}
-
-
Index: /trunk/src/lib/collision_reaction/cr_physics_full_walk.h
===================================================================
--- /trunk/src/lib/collision_reaction/cr_physics_full_walk.h	(revision 10012)
+++ /trunk/src/lib/collision_reaction/cr_physics_full_walk.h	(revision 10013)
@@ -9,11 +9,13 @@
 #include "collision_reaction.h"
 
+namespace CoRe
+{
 
-class Collision;
+  class Collision;
 
-//! A class representing a reaction to a collision: dealing damage to an object
-class CRPhysicsFullWalk : public CollisionReaction
-{
-  ObjectListDeclaration(CRPhysicsFullWalk);
+  //! A class representing a reaction to a collision: dealing damage to an object
+  class CRPhysicsFullWalk : public CollisionReaction
+  {
+    ObjectListDeclaration(CRPhysicsFullWalk);
   public:
     CRPhysicsFullWalk();
@@ -21,11 +23,5 @@
 
     virtual void reactToCollision(Collision* collision);
-
-    virtual void update(WorldEntity* entity);
-
-
-  private:
-    float        downspeed;
-};
-
+  };
+}
 #endif /* _CR_PHYSICS_FULL_WALK_H */
Index: /trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc
===================================================================
--- /trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc	(revision 10012)
+++ /trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc	(revision 10013)
@@ -34,99 +34,95 @@
 
 
+namespace CoRe
+{
 
-ObjectListDefinition(CRPhysicsGroundWalk);
-/**
- *  standard constructor
- */
-CRPhysicsGroundWalk::CRPhysicsGroundWalk ()
-    : CollisionReaction()
-{
-  this->registerObject(this, CRPhysicsGroundWalk::_objectList);
-}
+  ObjectListDefinition(CRPhysicsGroundWalk);
 
 
-/**
- *  standard deconstructor
- */
-CRPhysicsGroundWalk::~CRPhysicsGroundWalk ()
-{}
-
-
-/**
- * caluculates and applys the reaction to a specific collision
- *  @param collision the collision
- */
-void CRPhysicsGroundWalk::reactToCollision(Collision* collision)
-{
-
-  AABB* box = collision->getEntityB()->getModelAABB();
-  WorldEntity* entity = collision->getEntityB();
-
-  if( box == NULL)
+  /**
+   *  standard constructor
+   */
+  CRPhysicsGroundWalk::CRPhysicsGroundWalk ()
+      : CollisionReaction()
   {
-    PRINTF(2)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n");
-    return;
+    this->registerObject(this, CRPhysicsGroundWalk::_objectList);
   }
 
 
-  float CR_MAX_WALK_HEIGHT = 15.0f;
-
-  float height = 0.0f;
+  /**
+   *  standard deconstructor
+   */
+  CRPhysicsGroundWalk::~CRPhysicsGroundWalk ()
+  {}
 
 
-  const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
-  std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
-  for(; it != collisionEvents->end(); it++)
+  /**
+   * caluculates and applys the reaction to a specific collision
+   *  @param collision the collision
+   */
+  void CRPhysicsGroundWalk::reactToCollision(Collision* collision)
   {
 
-    CollisionEvent* ce = (*it);
-    Vector normal = ce->getGroundNormal();
+    AABB* box = collision->getEntityA()->getModelAABB();
+    WorldEntity* entity = collision->getEntityA();
 
-    // calculate the collision position
-    Vector collPos =  collision->getEntityB()->getAbsCoor()  + box->center - ce->getCollisionPosition();
-
-    // test the 3 axis differently
-    switch( ce->getType())
+    if( box == NULL)
     {
-        /* collision in the Y-AXIS */
-      case COLLISION_TYPE_AXIS_Y_NEG:
-        // calulate the height above ground
-        height = collPos.len() - box->halfLength[1];
+      PRINTF(2)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n");
+      return;
+    }
 
 
-        // object is beneath the plane (ground)
-        //         if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
-        if( height < 0.0f && -height < CR_MAX_WALK_HEIGHT)
-        {
-          entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f));
-          entity->setOnGround(true);
-        }
-        // object is already in the wall
-        else if( ce->isInWall())
-        {
-          entity->setAbsCoor(entity->getLastAbsCoor());
-        }
-        else
-        {
-          // entity is not on ground
-          entity->setOnGround(false);
-        }
-        break;
+    float CR_MAX_WALK_HEIGHT = 15.0f;
+
+    float height = 0.0f;
 
 
+    std::vector<CollisionEvent*>::const_iterator it = collision->begin();
+    for(; it != collision->end(); it++)
+    {
+
+      CollisionEvent* ce = (*it);
+      Vector normal = ce->getGroundNormal();
+
+      // calculate the collision position
+      Vector collPos =  collision->getEntityA()->getAbsCoor()  + box->center - ce->getCollisionPosition();
+
+      // test the 3 axis differently
+      switch( ce->getType())
+      {
+          /* collision in the Y-AXIS */
+        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG:
+          // calulate the height above ground
+          height = collPos.len() - box->halfLength[1];
+
+
+          // object is beneath the plane (ground)
+          //         if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
+          if( height < 0.0f && -height < CR_MAX_WALK_HEIGHT)
+          {
+            entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f));
+            entity->setOnGround(true);
+          }
+          // object is already in the wall
+          else if( ce->isInWall())
+          {
+            entity->setAbsCoor(entity->getLastAbsCoor());
+          }
+          else
+          {
+            // entity is not on ground
+            entity->setOnGround(false);
+          }
+          break;
+
+
+      }
     }
+    //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
+
   }
-  //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
-
-}
 
 
 
-
-/**
- * use this to do some collision offline calculations, only called for bContinuousPoll == true
- */
-void CRPhysicsGroundWalk::update(WorldEntity* owner)
-{}
-
-
+}
Index: /trunk/src/lib/collision_reaction/cr_physics_ground_walk.h
===================================================================
--- /trunk/src/lib/collision_reaction/cr_physics_ground_walk.h	(revision 10012)
+++ /trunk/src/lib/collision_reaction/cr_physics_ground_walk.h	(revision 10013)
@@ -9,11 +9,13 @@
 #include "collision_reaction.h"
 
+namespace CoRe
+{
 
-class Collision;
+  class Collision;
 
-//! A class representing a reaction to a collision: dealing damage to an object
-class CRPhysicsGroundWalk : public CollisionReaction
-{
-  ObjectListDeclaration(CRPhysicsGroundWalk);
+  //! A class representing a reaction to a collision: dealing damage to an object
+  class CRPhysicsGroundWalk : public CollisionReaction
+  {
+    ObjectListDeclaration(CRPhysicsGroundWalk);
   public:
     CRPhysicsGroundWalk();
@@ -22,10 +24,6 @@
     virtual void reactToCollision(Collision* collision);
 
-    virtual void update(WorldEntity* entity);
+  };
 
-
-  private:
-    float        downspeed;
-};
-
+}
 #endif /* _CR_PHYSICS_GROUND_WALK_H */
Index: /trunk/src/lib/graphics/importer/bsp_manager.cc
===================================================================
--- /trunk/src/lib/graphics/importer/bsp_manager.cc	(revision 10012)
+++ /trunk/src/lib/graphics/importer/bsp_manager.cc	(revision 10013)
@@ -46,5 +46,6 @@
 
 #include "aabb.h"
-#include "cr_defs.h"
+#include "cr_engine.h"
+#include "collision_tube.h"
 
 
@@ -1215,6 +1216,6 @@
   if( xCollisionForward)
   {
-    entity->registerCollision(COLLISION_TYPE_AXIS_X ,
-                              this->parent, entity,
+    CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X ,
+                              entity, this->parent,
                               Vector(testPlane->x, testPlane->y, testPlane->z),
                               collPos,
@@ -1254,6 +1255,6 @@
   if( xCollisionBackward)
   {
-    entity->registerCollision(COLLISION_TYPE_AXIS_X_NEG ,
-                              this->parent, entity,
+    CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X_NEG,
+                              entity, this->parent,
                               Vector(testPlane->x, testPlane->y, testPlane->z),
                               collPos,
@@ -1350,6 +1351,6 @@
   if( yCollisionUp)
   {
-    entity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent,
-                              entity,
+    CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y,
+                              entity, this->parent,
                               Vector(testPlane->x, testPlane->y, testPlane->z),
                               collPos, SolidFlag);
@@ -1403,11 +1404,9 @@
   if( yCollisionDown)
   {
-    entity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this->parent,
-                              entity,
+    CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG ,
+                              entity, this->parent,
                               Vector(testPlane->x, testPlane->y, testPlane->z),
                               collPos, SolidFlag);
   }
-
-
 }
 
@@ -1484,6 +1483,6 @@
 
   if( zCollisionRight) {
-    entity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent,
-                              entity,
+    CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z ,
+                              entity, this->parent,
                               Vector(testPlane->x, testPlane->y, testPlane->z),
                               collPos , SolidFlag);
@@ -1523,8 +1522,8 @@
 
   if( zCollisionLeft) {
-    entity->registerCollision(COLLISION_TYPE_AXIS_Z_NEG , this->parent,
-                              entity,
-                              Vector(testPlane->x, testPlane->y, testPlane->z),
-                              collPos , SolidFlag);
+    CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z_NEG ,
+                               entity, this->parent,
+                               Vector(testPlane->x, testPlane->y, testPlane->z),
+                               collPos , SolidFlag);
   }
 
Index: /trunk/src/story_entities/game_world.cc
===================================================================
--- /trunk/src/story_entities/game_world.cc	(revision 10012)
+++ /trunk/src/story_entities/game_world.cc	(revision 10013)
@@ -136,5 +136,5 @@
   AnimationPlayer::getInstance();
   PhysicsEngine::getInstance();
-  CREngine::getInstance();
+  CoRe::CREngine::getInstance();
 
   State::setScriptManager(&this->scriptManager);
@@ -219,5 +219,5 @@
   delete AnimationPlayer::getInstance();
   delete PhysicsEngine::getInstance();
-  delete CREngine::getInstance();
+  delete CoRe::CREngine::getInstance();
 
   State::setCurrentStoryEntity(NULL);
@@ -494,5 +494,5 @@
 void GameWorld::collisionReaction()
 {
-  CREngine::getInstance()->handleCollisions();
+  CoRe::CREngine::getInstance()->handleCollisions();
 }
 
Index: /trunk/src/story_entities/game_world_data.cc
===================================================================
--- /trunk/src/story_entities/game_world_data.cc	(revision 10012)
+++ /trunk/src/story_entities/game_world_data.cc	(revision 10013)
@@ -232,5 +232,4 @@
   State::setPlayer(this->localPlayer);
 
-  Playable* playable;
   if (!Playable::objectList().empty())
   {
Index: /trunk/src/world_entities/creatures/fps_player.cc
===================================================================
--- /trunk/src/world_entities/creatures/fps_player.cc	(revision 10012)
+++ /trunk/src/world_entities/creatures/fps_player.cc	(revision 10013)
@@ -167,5 +167,5 @@
 
     //subscribe to collision reaction
-  this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID());
+  this->subscribeReaction(CoRe::CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID());
 
   this->initWeapon = false;
Index: /trunk/src/world_entities/npcs/attractor_mine.cc
===================================================================
--- /trunk/src/world_entities/npcs/attractor_mine.cc	(revision 10012)
+++ /trunk/src/world_entities/npcs/attractor_mine.cc	(revision 10013)
@@ -62,4 +62,5 @@
 
   this->setDamage(30.0f);
+  this->subscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE, Playable::staticClassID());
 
 
Index: /trunk/src/world_entities/npcs/generic_npc.cc
===================================================================
--- /trunk/src/world_entities/npcs/generic_npc.cc	(revision 10012)
+++ /trunk/src/world_entities/npcs/generic_npc.cc	(revision 10013)
@@ -96,5 +96,5 @@
 
   // collision reaction registration
-  this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID());
+  this->subscribeReaction(CoRe::CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID());
 }
 
Index: /trunk/src/world_entities/projectiles/projectile.cc
===================================================================
--- /trunk/src/world_entities/projectiles/projectile.cc	(revision 10012)
+++ /trunk/src/world_entities/projectiles/projectile.cc	(revision 10013)
@@ -23,4 +23,5 @@
 #include "model.h"
 #include "sound/resource_sound_buffer.h"
+#include "playable.h"
 
 #include "debug.h"
@@ -43,4 +44,5 @@
   this->setHealth(1.0f);
   this->setDamage(1.0f); // default damage of a projectile set to 100.0 damage points
+  this->subscribeReaction( CoRe::CREngine::CR_PHYSICS_FULL_WALK, Playable::staticClassID());
 
   //this->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
Index: /trunk/src/world_entities/space_ships/spacecraft_2d.cc
===================================================================
--- /trunk/src/world_entities/space_ships/spacecraft_2d.cc	(revision 10012)
+++ /trunk/src/world_entities/space_ships/spacecraft_2d.cc	(revision 10013)
@@ -221,5 +221,6 @@
   registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) );
 
-
+  this->setDamage( 1000.0f);
+  this->subscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE, WorldEntity::staticClassID());
 
 }
Index: /trunk/src/world_entities/weapons/aiming_system.cc
===================================================================
--- /trunk/src/world_entities/weapons/aiming_system.cc	(revision 10012)
+++ /trunk/src/world_entities/weapons/aiming_system.cc	(revision 10013)
@@ -61,6 +61,6 @@
 
   // registering default reactions:
-  this->unsubscribeReaction(CREngine::CR_OBJECT_DAMAGE);
-  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, WorldEntity::staticClassID());
+  this->unsubscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE);
+  this->subscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE, WorldEntity::staticClassID());
 
   this->range = 1000.0f;
Index: /trunk/src/world_entities/world_entity.cc
===================================================================
--- /trunk/src/world_entities/world_entity.cc	(revision 10012)
+++ /trunk/src/world_entities/world_entity.cc	(revision 10013)
@@ -35,5 +35,5 @@
 #include "camera.h"
 
-#include "collision_handle.h"
+#include "collision_filter.h"
 #include "collision_event.h"
 #include "game_rules.h"
@@ -58,5 +58,5 @@
  */
 WorldEntity::WorldEntity()
-    : Synchronizeable()
+  : Synchronizeable(), _collisionFilter(this)
 {
   this->registerObject(this, WorldEntity::_objectList);
@@ -77,22 +77,18 @@
   this->lastObjectListNumber = OM_INIT;
 
-  // reset all collision handles to NULL == unsubscribed state
-  for(int i = 0; i < CREngine::CR_NUMBER; ++i)
-    this->collisionHandles[i] = NULL;
-  this->bReactive = false;
-  this->bOnGround = false;
+  this->_bOnGround = false;
 
   // registering default reactions:
-  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, /* WorldEntity::staticClassID(), */ Projectile::staticClassID());
+  this->subscribeReaction(CoRe::CREngine::CR_OBJECT_DAMAGE, Projectile::staticClassID());
 
   this->toList(OM_NULL);
 
-  registerVar( new SynchronizeableString( &this->md2TextureFileName, &this->md2TextureFileName, "md2TextureFileName", PERMISSION_MASTER_SERVER ) );
-  modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName", PERMISSION_MASTER_SERVER ) );
-  scaling_handle = registerVarId( new SynchronizeableFloat( &scaling, &scaling, "scaling", PERMISSION_MASTER_SERVER ) );
-  list_handle = registerVarId( new SynchronizeableInt( (int*)&objectListNumber, &list_write, "list", PERMISSION_MASTER_SERVER ) );
-
-  health_handle = registerVarId( new SynchronizeableFloat( &this->health, &this->health_write, "health", PERMISSION_MASTER_SERVER ) );
-  healthMax_handle = registerVarId( new SynchronizeableFloat( &this->healthMax, &this->healthMax_write, "maxHealth", PERMISSION_MASTER_SERVER ) );
+  this->registerVar( new SynchronizeableString( &this->md2TextureFileName, &this->md2TextureFileName, "md2TextureFileName", PERMISSION_MASTER_SERVER ) );
+  this->modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName", PERMISSION_MASTER_SERVER ) );
+  this->scaling_handle = registerVarId( new SynchronizeableFloat( &scaling, &scaling, "scaling", PERMISSION_MASTER_SERVER ) );
+  this->list_handle = registerVarId( new SynchronizeableInt( (int*)&objectListNumber, &list_write, "list", PERMISSION_MASTER_SERVER ) );
+
+  this->health_handle = registerVarId( new SynchronizeableFloat( &this->health, &this->health_write, "health", PERMISSION_MASTER_SERVER ) );
+  this->healthMax_handle = registerVarId( new SynchronizeableFloat( &this->healthMax, &this->healthMax_write, "maxHealth", PERMISSION_MASTER_SERVER ) );
 }
 
@@ -115,5 +111,5 @@
     delete this->healthWidget;
 
-  this->unsubscribeReaction();
+  this->unsubscribeReactions();
 }
 
@@ -302,10 +298,7 @@
  *  @param target1 a filter target (classID)
  */
-void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1)
-{
-  this->subscribeReaction(type);
-
-  // add the target filter
-  this->collisionHandles[type]->addTarget(target1);
+void WorldEntity::subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1)
+{
+  this->_collisionFilter.subscribeReaction(type, target1);
 }
 
@@ -316,11 +309,7 @@
  *  @param target1 a filter target (classID)
  */
-void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2)
-{
-  this->subscribeReaction(type);
-
-  // add the target filter
-  this->collisionHandles[type]->addTarget(target1);
-  this->collisionHandles[type]->addTarget(target2);
+void WorldEntity::subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2)
+{
+  this->_collisionFilter.subscribeReaction(type, target1, target2);
 }
 
@@ -331,50 +320,7 @@
  *  @param target1 a filter target (classID)
  */
-void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3)
-{
-  this->subscribeReaction(type);
-
-  // add the target filter
-  this->collisionHandles[type]->addTarget(target1);
-  this->collisionHandles[type]->addTarget(target2);
-  this->collisionHandles[type]->addTarget(target3);
-}
-
-
-/**
- * subscribes this world entity to a collision reaction
- *  @param type the type of reaction to subscribe to
- *  @param target1 a filter target (classID)
- */
-void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4)
-{
-  this->subscribeReaction(type);
-
-  // add the target filter
-  this->collisionHandles[type]->addTarget(target1);
-  this->collisionHandles[type]->addTarget(target2);
-  this->collisionHandles[type]->addTarget(target3);
-  this->collisionHandles[type]->addTarget(target4);
-}
-
-
-/**
- * subscribes this world entity to a collision reaction
- *  @param type the type of reaction to subscribe to
- *  @param nrOfTargets number of target filters
- *  @param ... the targets as classIDs
- */
-void WorldEntity::subscribeReaction(CREngine::CRType type)
-{
-  if( this->collisionHandles[type] != NULL)
-  {
-    PRINTF(2)("Registering for a CollisionReaction already subscribed to! Skipping\n");
-    return;
-  }
-
-  this->collisionHandles[type] = CREngine::getInstance()->subscribeReaction(this, type);
-
-  // now there is at least one collision reaction subscribed
-  this->bReactive = true;
+void WorldEntity::subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2, const ClassID& target3)
+{
+  this->_collisionFilter.subscribeReaction(type, target1, target2, target3);
 }
 
@@ -384,22 +330,7 @@
  *  @param type the reaction to unsubscribe
  */
-void WorldEntity::unsubscribeReaction(CREngine::CRType type)
-{
-  if( this->collisionHandles[type] == NULL)
-    return;
-
-  CREngine::getInstance()->unsubscribeReaction(this->collisionHandles[type]);
-  this->collisionHandles[type] = NULL;
-
-  // check if there is still any handler registered
-  for(int i = 0; i < CREngine::CR_NUMBER; ++i)
-  {
-    if( this->collisionHandles[i] != NULL)
-    {
-      this->bReactive = true;
-      return;
-    }
-  }
-  this->bReactive = false;
+void WorldEntity::unsubscribeReaction(CoRe::CREngine::ReactionType type)
+{
+  this->_collisionFilter.unsubscribeReaction(type);
 }
 
@@ -408,61 +339,7 @@
  * unsubscribes all collision reactions
  */
-void WorldEntity::unsubscribeReaction()
-{
-  for( int i = 0; i < CREngine::CR_NUMBER; i++)
-    this->unsubscribeReaction((CREngine::CRType)i);
-
-  // there are no reactions subscribed from now on
-  this->bReactive = false;
-}
-
-
-/**
- * registers a new collision event to this world entity
- *  @param entityA entity of the collision
- *  @param entityB entity of the collision
- *  @param bvA colliding bounding volume of entityA
- *  @param bvB colliding bounding volume of entityA
- */
-bool WorldEntity::registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB)
-{
-  PRINTF(5)("registering collision of type: %s vs %s\n", entityA->getClassCName(), entityB->getClassCName());
-  // is there any handler listening?
-  if( !this->bReactive)
-    return false;
-
-  // get a collision event
-  CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject();
-  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
-  c->collide(COLLISION_TYPE_OBB, entityA, entityB, bvA, bvB);
-
-  for( int i = 0; i < CREngine::CR_NUMBER; ++i)
-    if( this->collisionHandles[i] != NULL)
-      this->collisionHandles[i]->registerCollisionEvent(c);
-  return true;
-}
-
-
-/**
- * registers a new collision event to this woeld entity
- *  @param entity the entity that collides
- *  @param plane it stands on
- *  @param position it collides on the plane
- */
-bool WorldEntity::registerCollision(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall)
-{
-  // is there any handler listening?
-  if( !this->bReactive)
-    return false;
-
-  // get a collision event
-  CollisionEvent* c = CREngine::getInstance()->popCollisionEventObject();
-  assert(c != NULL); // if this should fail: we got not enough precached CollisionEvents: alter value in cr_defs.h
-  c->collide(type, entity, groundEntity, normal, position, bInWall);
-
-  for( int i = 0; i < CREngine::CR_NUMBER; ++i)
-    if( this->collisionHandles[i] != NULL)
-      this->collisionHandles[i]->registerCollisionEvent(c);
-  return true;
+void WorldEntity::unsubscribeReactions()
+{
+  this->_collisionFilter.unsubscribeReactions();
 }
 
Index: /trunk/src/world_entities/world_entity.h
===================================================================
--- /trunk/src/world_entities/world_entity.h	(revision 10012)
+++ /trunk/src/world_entities/world_entity.h	(revision 10013)
@@ -12,4 +12,5 @@
 
 #include "cr_engine.h"
+#include "collision_filter.h"
 #include "object_manager.h"
 #include "glincl.h"
@@ -25,4 +26,5 @@
 namespace OrxSound { class SoundBuffer; class SoundSource; }
 namespace OrxGui { class GLGuiWidget; class GLGuiBar; class GLGuiEnergyWidget; };
+namespace CoRe { class Collision; }
 
 class BVTree;
@@ -30,10 +32,4 @@
 class AABBTreeNode;
 class Model;
-class CollisionHandle;
-class Collision;
-
-
-//class CharacterAttributes;
-
 
 
@@ -42,4 +38,5 @@
 {
   ObjectListDeclaration(WorldEntity);
+
 public:
   WorldEntity();
@@ -51,5 +48,5 @@
   void loadModel2(const std::string& fileN, float scal = 1.0f){this->loadModel(fileN,scal,0,4);}
   void setModel(Model* model, unsigned int modelNumber = 0);
-Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
+  Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
 
   inline void loadMD2Texture(const std::string& fileName) { this->md2TextureFileName = fileName; }
@@ -74,5 +71,4 @@
   virtual void collidesWithGround(const Vector& feet, const Vector& ray_1, const Vector& ray_2);
 
-
   /** @returns a reference to the obb tree of this worldentity */
   inline BVTree* getOBBTree() const { return this->obbTree; };
@@ -81,27 +77,31 @@
   inline AABB* getModelAABB() const { return (this->aabbNode)?this->aabbNode->getAABB():NULL;}
 
+  virtual void hit(float damage, WorldEntity* killer);
+
+
   /* --- Collision Reaction Block --- */
-  void subscribeReaction(CREngine::CRType type);
-  void subscribeReaction(CREngine::CRType type, const ClassID& target1);
-  void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2);
-  void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3);
-  void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4);
-
-  void unsubscribeReaction(CREngine::CRType type);
-  void unsubscribeReaction();
-
-  bool registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB);
-  bool registerCollision(int type, WorldEntity* entity, WorldEntity* groundEntity, Vector normal, Vector position, bool bInWall = false);
+  void subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1);
+  void subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2);
+  void subscribeReaction(CoRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2, const ClassID& target3);
+
+  void unsubscribeReaction(CoRe::CREngine::ReactionType type);
+  void unsubscribeReactions();
+
   /** @return true if there is at least on collision reaction subscribed */
-  inline bool isReactive() const { return this->bReactive; }
-
-  CollisionHandle* getCollisionHandle(CREngine::CRType type) const { return this->collisionHandles[type]; }
+  inline bool isReactive() const { return this->_collisionFilter.isReactive(); }
+
+  /** @param worldEntity the world entity to be checked @returns true if there is a collisionreaction registered for the worldEntity */
+  inline bool isReactive( const WorldEntity& worldEntity) const { return this->_collisionFilter(worldEntity); }
+  /** @param worldEntity the world entity to be checked @param type special reaction type @returns true if collision reaction reg. */
+  inline bool isReactive( const WorldEntity& worldEntity, const CoRe::CREngine::ReactionType& type) const
+  { return this->_collisionFilter(worldEntity, type); }
+
+
+  const CoRe::CollisionFilter& getCollisionFilter(CoRe::CREngine::ReactionType type) const { return this->_collisionFilter; }
 
   /** @returns true if this entity is standing on ground (BSP model) */
-  bool isOnGround() const { return this->bOnGround; }
+  bool isOnGround() const { return this->_bOnGround; }
   /** @param flag: marks if this entity is standing on ground */
-  void setOnGround(bool flag) { this->bOnGround = flag; }
-
-  virtual void hit(float damage, WorldEntity* killer);
+  void setOnGround(bool flag) { this->_bOnGround = flag; }
 
   virtual void destroy( WorldEntity* killer );
@@ -128,10 +128,10 @@
 
   void hide() { if( this->objectListNumber != OM_DEAD) this->lastObjectListNumber = this->objectListNumber; this->toList(OM_DEAD); }
-void unhide() { if( this->objectListNumber != this->lastObjectListNumber) this->toList(this->lastObjectListNumber); }
+  void unhide() { if( this->objectListNumber != this->lastObjectListNumber) this->toList(this->lastObjectListNumber); }
 
 
   /* --- Character Attribute Block --- */
   /** @returns the scaling of the model */
-float getScaling(){return this->scaling;}
+  float getScaling(){return this->scaling;}
   /** @returns the damage dealt by this world entity */
   float getDamage() const { return this->damage; }
@@ -170,8 +170,10 @@
   void setHealthMax(float healthMax);
   void createHealthWidget();
-
-  //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
+    //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
+
+
 private:
   void updateHealthWidget();
+
 
 private:
@@ -195,6 +197,11 @@
   OM_LIST                 lastObjectListNumber;            //!< the last ObjectList from the ObjectManager this Entity was is in
 
-
-
+  /* collision reaction stuff */
+  CoRe::CollisionFilter   _collisionFilter;                //!< filter for collision event filtering (not every entity listens to all collisions)
+  bool                    _bOnGround;                      //!< flag true if the object is on the ground
+
+  PhysicsInterface        physicsInterface;                //!< the physics object of the WorldEntity
+
+  /* network help structures */
   float                   scaling;                         //!< model's scaling factor
   int                     scaling_handle;                  //!< handle for syncing var
@@ -212,9 +219,5 @@
   int                     healthMax_handle;
 
-  CollisionHandle*        collisionHandles[CREngine::CR_NUMBER];  //!< the list of the collision reactions
-  bool                    bReactive;                              //!< true if there is at least one collision reaction subscibed
-
-  PhysicsInterface        physicsInterface;                //!< the physics object of the WorldEntity
-  bool                    bOnGround;                       //!< true if this entity is standing on the ground
+
 
 protected:
