Index: branches/ai/src/ai/ai_team_member.cc
===================================================================
--- branches/ai/src/ai/ai_team_member.cc	(revision 10062)
+++ branches/ai/src/ai/ai_team_member.cc	(revision 10071)
@@ -34,5 +34,5 @@
 	for(int i=0; i < moduleCount; i++ )
 	{
-   	std::cout << "Processing AIModule " << i << " (" << moduleCount << ")\n";
+   	//std::cout << "Processing AIModule " << i << " (" << moduleCount << ")\n";
    	modules.at(i)->process();
 	}
@@ -48,8 +48,8 @@
 	int teamNumber=aiEngine->newTeam();
 	aiEngine->getTeam(teamNumber)->addMember(this);
+
 	MovementModule* nMod=new MovementModule;
-	nMod->process();
-	modules.push_back(nMod);
-	modules.at(0)->process();
+	addModule(nMod);
+	//nMod->testModule=nMod;
 }
 
Index: branches/ai/src/ai/movement_module.cc
===================================================================
--- branches/ai/src/ai/movement_module.cc	(revision 10062)
+++ branches/ai/src/ai/movement_module.cc	(revision 10071)
@@ -19,4 +19,14 @@
 #include "state.h"
 #include "debug.h"
+#include "player.h"
+#include "playable.h"
+#include "aabb.h"
+#include "npcs/npc_test.h"
+
+#include "shell_command.h"
+/*SHELL_COMMAND(model, WorldEntity, loadModel)
+->describe("sets the Model of the WorldEntity")
+->defaultValues("models/ships/fighter.obj", 1.0f);*/
+
 
 //class AIEngine;
@@ -30,31 +40,100 @@
 
 
-void MovementModule::process()
+float MovementModule::getSize(WorldEntity* object)
 {
-	//float dt=AIEngine::getInstance()->dtS;
-	std::cout << "///////////////////Processing Movement Module/////////////////////\n";
+	AABB* aabb = object->getModelAABB();
+	Vector a = aabb->getAxisX();
+	Vector b = aabb->getAxisY();
+	Vector c = aabb->getAxisZ();
 
-	//How does the Module know the AITeamMember it belongs to??
-	//partialy solved...
-	/*
-	Vector absPosition = owner->getAbsCoor();
+	float da=a.len();
+	float db=b.len();
+	float dc=c.len();
+	float size;
 
-	PRINTF(0)(" npc abs coor: %f, %f, %f\n", absPosition.x, absPosition.y, absPosition.z);
+	if(da>db){
+		size=(dc>da)?dc:da;
+	}else{
+		size=(dc>db)?dc:db;
+	}
 
-	//Player* pl = State::getPlayer();
-	/*Vector playerAbsPos = pl->getPlayable()->getAbsCoor();
-
-	//PRINTF(0)(" player abs coor: %f, %f, %f\n", playerAbsPos.x, playerAbsPos.y, playerAbsPos.z);
-
-
-  // intelligent reaction
-
-	Vector distanceVector = playerAbsPos - absPosition;
-	distanceVector.normalize();
-
-	float speed = 10.0f;
-
-	owner->shiftCoor( distanceVector * speed * dt);*/
+	return size;
 }
 
 
+
+
+void MovementModule::process()
+{
+	float dt=AIEngine::getInstance()->dtS;
+	if( owner == NULL) return;
+	Vector myAbsPos = owner->getAbsCoor();
+
+	//PRINTF(0)(" NPC abs coor: %f, %f, %f\n", myAbsPos.x, myAbsPos.y, myAbsPos.z);
+
+	Player* pl = State::getPlayer();
+	if( pl == NULL) return;
+	Vector playerAbsPos = pl->getPlayable()->getAbsCoor();
+
+	//PRINTF(0)(" Player abs coor: %f, %f, %f\n", playerAbsPos.x, playerAbsPos.y, playerAbsPos.z);
+
+	////////////
+
+	float a=50.0f;
+	float keepDist= this->getSize(owner);//+ this->getSize(pl->getPlayable());
+	std::cout << "Distance: " << keepDist << "\n";
+
+
+	Vector vectorToPlayer = playerAbsPos - myAbsPos;
+	float dist=vectorToPlayer.len();
+	Vector nVectorToPlayer=vectorToPlayer/dist*(dist-keepDist);
+
+
+
+
+
+	// std::vector<Vector> collisonCorrection;
+	// get all npcs
+
+	Vector tempNPCpos;
+	Vector tempCorrectionVect;
+	Vector antiCollision;
+
+	for (ObjectList<NPC2>::const_iterator it = NPC2::objectList().begin();
+			 it != NPC2::objectList().end();
+			 ++it)
+	{
+		if(*it==owner)continue;
+		tempNPCpos=(*it)->getAbsCoor();
+		tempCorrectionVect = myAbsPos-tempNPCpos;
+		tempCorrectionVect=tempCorrectionVect*1/(tempCorrectionVect.len());
+		//PRINTF(0)("class: %s\n", (*it)->getCName());
+		antiCollision=antiCollision+tempCorrectionVect;
+	}
+
+
+
+	Vector correction=antiCollision+nVectorToPlayer-v;
+	//Vector nCorrection=
+	correction.y=0;
+	float correctionLen=correction.len();
+	if(correctionLen>a*dt)correction=correction/correctionLen*a*dt;
+	v+=correction;
+
+
+	//Move NPC...
+	owner->shiftCoor(v*dt);
+
+	//Rotate NPC
+	Vector view = v+correction;
+	//if(vectorToPlayer.dot(view)<0){
+		//view = v.cross( Vector(0,1,0) ).getNormalized();
+	//}else{
+		view = v.cross( Vector(0,-1,0) ).getNormalized();
+	//}
+	//if(dist<keepDist)view=view*-1;
+	owner->setAbsDir( Quaternion( view, Vector(0,1,0)));
+	//owner->setAbsDirSoft( Quaternion( view, Vector(0,1,0)),1.5);
+}
+
+
Index: branches/ai/src/ai/movement_module.h
===================================================================
--- branches/ai/src/ai/movement_module.h	(revision 10062)
+++ branches/ai/src/ai/movement_module.h	(revision 10071)
@@ -4,4 +4,6 @@
 
 #include "ai_module.h"
+#include "player.h"
+#include "playable.h"
 
 class MovementModule : public AIModule{
@@ -11,5 +13,6 @@
    virtual void process();
  private:
-	//AITeamMember* owner;
+	 Vector v;
+	 float getSize(WorldEntity* object);
 };
 
Index: branches/ai/src/world_entities/npcs/npc_test.cc
===================================================================
--- branches/ai/src/world_entities/npcs/npc_test.cc	(revision 10062)
+++ branches/ai/src/world_entities/npcs/npc_test.cc	(revision 10071)
@@ -61,5 +61,5 @@
 {
   // animating the md2 model
-  if( likely(this->getModel(0) != NULL))
+	if( likely(this->getModel(0) != NULL) && this->getModel(0)->isA(MD2Model::staticClassID()))
     ((MD2Model*)this->getModel(0))->tick(dt);
 }
