Index: trunk/src/world_entities/WorldEntities.am
===================================================================
--- trunk/src/world_entities/WorldEntities.am	(revision 8147)
+++ trunk/src/world_entities/WorldEntities.am	(revision 8186)
@@ -15,4 +15,5 @@
                 world_entities/test_entity.cc \
                 world_entities/planet.cc \
+		world_entities/bsp_entity.cc \
                 \
                 world_entities/weapons/test_gun.cc \
@@ -67,4 +68,5 @@
                 test_entity.h \
                 planet.h \
+		bsp_entity.h \
                 \
                 weapons/test_gun.h \
Index: trunk/src/world_entities/bsp_entity.cc
===================================================================
--- trunk/src/world_entities/bsp_entity.cc	(revision 8186)
+++ trunk/src/world_entities/bsp_entity.cc	(revision 8186)
@@ -0,0 +1,118 @@
+/*
+   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: ...
+   co-programmer: ...
+*/
+
+#include "bsp_entity.h"
+#include "util/loading/resource_manager.h"
+
+CREATE_FACTORY(BSPEntity, CL_BSP_ENTITY);
+
+
+/**
+ * constructs and loads a BSPEntity from a XML-element
+ * @param root the XML-element to load from
+ */
+BSPEntity::BSPEntity(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+
+/**
+ * standard deconstructor
+ */
+BSPEntity::~BSPEntity ()
+{
+
+}
+
+void BSPEntity::setName(const std::string& name)
+{
+  printf("+++++++++++ LOADING NAME %s\n", name.c_str());
+
+  this->bspManager->load(name.c_str(), 0.1f);
+}
+
+
+
+/**
+ * initializes the BSPEntity
+ * @todo change this to what you wish
+ */
+void BSPEntity::init()
+{
+  this->bspManager = new BspManager();
+  this->setClassID(CL_BSP_ENTITY, "BSPEntity");
+
+  this->toList(OM_ENVIRON);
+
+  /**
+   * @todo: Write CL_BSP_ENTITY INTO THE src/defs/class_id.h (your own definition)
+   */
+
+}
+
+
+/**
+ * loads a BSPEntity from a XML-element
+ * @param root the XML-element to load from
+ * @todo make the class Loadable
+ */
+void BSPEntity::loadParams(const TiXmlElement* root)
+{
+  // all the clases this Entity is directly derived from must be called in this way, to load all settings.
+ // WorldEntity::loadParam(root);
+
+  LoadParam(root, "Name", this, BSPEntity, setName)
+      .describe("Sets the of the BSP file.");
+
+/*  LoadParam(root, "Scale", this, BSpEntity, setScale)
+      .describe("Sets the scale factore of the bsp level.");
+*/
+
+  /**
+   * @todo: make the class Loadable
+   */
+}
+
+
+/**
+ * advances the BSPEntity about time seconds
+ * @param time the Time to step
+ */
+void BSPEntity::tick(float time)
+{
+
+}
+
+
+/**
+ * draws this worldEntity
+ */
+void BSPEntity::draw () const
+{
+  this->bspManager->draw();
+}
+
+
+/**
+ *
+ *
+ */
+void BSPEntity::collidesWith (WorldEntity* entity, const Vector& location)
+{
+
+}
Index: trunk/src/world_entities/bsp_entity.h
===================================================================
--- trunk/src/world_entities/bsp_entity.h	(revision 8186)
+++ trunk/src/world_entities/bsp_entity.h	(revision 8186)
@@ -0,0 +1,40 @@
+/*!
+ * @file bsp_entity.h
+ * @brief description
+*/
+
+#ifndef _BSP_ENTITY_H
+#define _BSP_ENTITY_H
+
+#include "world_entity.h"
+#include "bsp_manager.h"
+
+#include "util/loading/factory.h"
+#include "util/loading/load_param.h"
+
+
+
+//! A Class to ...
+class BSPEntity : public WorldEntity
+{
+ 
+ public:
+  BSPEntity(const TiXmlElement* root = NULL);
+  virtual ~BSPEntity();
+
+  virtual void loadParams(const TiXmlElement* root);
+  
+  void setName(const std::string& name);
+
+  void init();
+
+  virtual void draw() const;
+  virtual void tick(float time);
+  virtual void collidesWith (WorldEntity* entity, const Vector& location);
+
+ private:
+   BspManager* bspManager;
+
+};
+
+#endif /* _BSP_ENTITY_H */
Index: trunk/src/world_entities/world_entity.cc
===================================================================
--- trunk/src/world_entities/world_entity.cc	(revision 8147)
+++ trunk/src/world_entities/world_entity.cc	(revision 8186)
@@ -312,4 +312,43 @@
 
 /**
+ *  this function is called, when two entities collide
+ * @param entity: the world entity with whom it collides
+ *
+ * Implement behaviour like damage application or other miscellaneous collision stuff in this function
+ */
+void WorldEntity::collidesWithGround(const Vector& location)
+{
+  PRINTF(0)("BSP_GROUND: %s collides \n", this->getClassName() );
+}
+
+void WorldEntity::collidesWithGround(const Vector& feet, const Vector& ray_1, const Vector& ray_2)
+{
+  
+  // PRINTF(0)("BSP_GROUND: Player collides \n", this->getClassName() );
+  
+  Vector v = this->getAbsDirX();
+  v.x *= 10;
+  v.y *= 10;
+  v.z *= 10;
+  Vector u = this->getAbsDirY();
+  
+  if(feet.x == (u.x+this->getAbsCoor().x) &&  feet.y == u.y +this->getAbsCoor().y && feet.z == this->getAbsCoor().z)
+  {
+    
+  this->setAbsCoor(ray_2 - v);
+  }
+  else
+  {
+    if(ray_1.x == this->getAbsCoor().x + v.x && ray_1.y == this->getAbsCoor().y + v.y + 0.1 && ray_1.z ==this->getAbsCoor().z + v.z)
+    {
+      this->setAbsCoor(feet -u );  
+    }
+      
+    this->setAbsCoor(ray_2 - v);  
+   
+  }
+}
+
+/**
  *  this is called immediately after the Entity has been constructed, initialized and then Spawned into the World
  *
Index: trunk/src/world_entities/world_entity.h
===================================================================
--- trunk/src/world_entities/world_entity.h	(revision 8147)
+++ trunk/src/world_entities/world_entity.h	(revision 8186)
@@ -63,5 +63,9 @@
   bool buildObbTree(int depth);
   virtual void collidesWith (WorldEntity* entity, const Vector& location);
-  /** @returns a reference to the obb tree of this worldentity */
+  virtual void collidesWithGround(const Vector& location);
+  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; };
   void drawBVTree(int depth, int drawMode) const;
