Index: code/branches/AI/bin/resources.cfg
===================================================================
--- code/branches/AI/bin/resources.cfg	(revision 211)
+++ code/branches/AI/bin/resources.cfg	(revision 212)
@@ -8,13 +8,13 @@
 FileSystem=../Media
 FileSystem=../Media/fonts
-#FileSystem=../Media/materials/programs
-#FileSystem=../Media/materials/scripts
-#FileSystem=../Media/materials/textures
-#FileSystem=../Media/models
+FileSystem=../Media/materials/programs
+FileSystem=../Media/materials/scripts
+FileSystem=../Media/materials/textures
+FileSystem=../Media/models
 #FileSystem=../Media/overlays
 #FileSystem=../Media/particle
 FileSystem=../Media/gui
 #FileSystem=../Media/DeferredShadingMedia
-#Zip=../Media/packs/cubemap.zip
+Zip=../Media/packs/cubemap.zip
 #Zip=../Media/packs/cubemapsJS.zip
 #Zip=../Media/packs/dragon.zip
Index: code/branches/AI/src/CMakeLists.txt
===================================================================
--- code/branches/AI/src/CMakeLists.txt	(revision 211)
+++ code/branches/AI/src/CMakeLists.txt	(revision 212)
@@ -4,5 +4,5 @@
 
 SET(SRC_FILES orxonox.cc loader/LevelLoader.cc xml/xmlParser.cc)
-SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h)
+SET(INC_FILES loader/LevelLoader.h xml/xmlParser.h Flocking.h)
 
 #Creates an executable
Index: code/branches/AI/src/Flocking.h
===================================================================
--- code/branches/AI/src/Flocking.h	(revision 212)
+++ code/branches/AI/src/Flocking.h	(revision 212)
@@ -0,0 +1,123 @@
+
+//My Flocking Class
+
+#ifndef Flocking_Class
+#define Flocking_Class
+
+#include <Ogre.h>
+#include <OgreVector3.h>
+
+
+#endif
+
+using namespace std;
+using namespace Ogre;
+
+class Element // An element that flocks
+{
+
+  public:
+    Vector3 location;  // locationvector of the element
+    Vector3 speed;  // speedvector of the element
+    Vector3 acceleration;  // accelerationvector of the element
+
+
+  void element(Vector3 location_, Vector3 speed_, Vector3 acceleration_) {
+    acceleration = acceleration_;
+    speed = speed_;
+    location = location_;
+  }
+
+  //calculates the distance between the element and an other point given by temp
+  float getDistance(Element temp) {
+    Vector3 distance = temp.location-location;  //this doesn't work
+    return distance.length();
+  }
+
+//EINF[GEN DES ELEMENTS
+  void update(/*Element übergeben*/) {
+    calculateAcceleration(/*Elementübergabe*/);  //updates the acceleration
+    calculateSpeed();  //updates the speed
+    calculateLocation();  //updates the location
+  }
+
+//EINF[GEN DES ELEMENTS
+  void calculateAcceleration(/*Element übergeben*/) {
+  //calculates the accelerationvector based on the steeringvectors of
+  //separtion, alignment and cohesion.
+  acceleration = acceleration + separation() + alignment() + cohesion();
+  }
+
+  void calculateSpeed() {
+  speed = speed + acceleration;
+  }
+
+  void calculateLocation() {
+  location = location + speed;
+  acceleration = (0,0,0);  //set acceleration to zero for the next calculation
+  }
+
+  Vector3 separation() {
+    Vector3 steering; //steeringvector
+    int numberOfNeighbour;  //number of observed neighbours
+    //go through all elements
+    for(int i=1; i<3; i++) {  //just working with 3 elements at the moment
+      Element actual = arrayOfElements[i];  //get the actual element
+      float distance = Element.getDistance(actual);  //get distance between this and actual
+//DUMMY SEPERATION DETECTION DISTANCE = 25
+      if ((distance > 0) && (distance<25)) {  //do only if actual is inside detectionradius
+        Vector3 inverseDistance = actual.location-location;  //calculate the distancevector heading towards this
+        inverseDistance = inverseDistance.normalise(); //does this work correctly?  //normalise the distancevector
+        inverseDistance = inverseDistance/distance;  //devide distancevector by distance (the closer the bigger gets the distancevector -> steeringvector)
+        steering = steering + inverseDistance;  //add up all significant steeringvectors
+        numberOfNeighbour++;  //counts the elements inside the detectionradius
+      }
+    }
+    if(numberOfNeighbour > 0) {
+    steering = steering / (float)numberOfNeighbour;  //devide the sum of steeringvectors by the number of elements -> separation steeringvector
+    }
+    return steering;
+  }
+
+  Vector3 alignment() {
+    Vector3 steering; //steeringvector
+    int numberOfNeighbour;  //number of observed neighbours
+    //go through all elements
+    for(int i=1; i<3; i++) {  //just working with 3 elements at the moment
+      Element actual = arrayOfElements[i];  //get the actual element
+      float distance = Element.getDistance(actual);  //get distance between this and actual
+//DUMMY ALIGNMENT DETECTION DISTANCE = 50
+      if ((distance > 0) && (distance<50)) {  //check if actual element is inside detectionradius
+        steering = steering + actual.speed;  //add up all speedvectors inside the detectionradius
+        numberOfNeighbour++;  //counts the elements inside the detectionradius
+      }
+    }
+    if(numberOfNeighbour > 0) {
+    steering = steering / (float)numberOfNeighbour;  //devide the sum of steeringvectors by the number of elements -> alignment steeringvector
+    }
+    return steering;
+  }
+
+  Vector3 cohesion() {
+    Vector3 steering; //steeringvector
+    int numberOfNeighbour;  //number of observed neighbours
+    //go through all elements
+    for(int i=1; i<3; i++) {  //just working with 3 elements at the moment
+      Element actual = arrayOfElements[i];  //get the actual element
+      float distance = Element.getDistance(actual);  //get distance between this and actual
+// DUMMY COHESION DETECTION DISTANCE = 50
+      if ((distance > 0) && (distance<50)) {  //check if actual element is inside detectionradius
+        steering = steering + actual.location;  //add up all locations of elements inside the detectionradius
+        numberOfNeighbour++;  //counts the elements inside the detectionradius
+      }
+     }
+    if(numberOfNeighbour > 0) {
+    steering = steering  / (float)numberOfNeighbour;  //devide the sum steeringvector by the number of elements -> cohesion steeringvector
+    }
+  }
+
+};
+
+
+
+//End of My Flocking Class
Index: code/branches/AI/src/orxonox.cc
===================================================================
--- code/branches/AI/src/orxonox.cc	(revision 211)
+++ code/branches/AI/src/orxonox.cc	(revision 212)
@@ -41,5 +41,5 @@
 #include "xml/xmlParser.h"
 #include "loader/LevelLoader.h"
-
+#include "Flocking.h"
 
 // some tests to see if enet works without includsion
@@ -76,20 +76,37 @@
 using namespace Ogre;
 
+//my-stuff
+//globale definition eines Arrays welches alle nodes enthält
+Vector3 ElementLocationArray[2];
+Vector3 ElementSpeedArray[2];
+Vector3 ElementAccelerationArray[2];
+
+
+
 class OrxExitListener : public FrameListener
 {
   public:
-    OrxExitListener(OIS::Keyboard *keyboard)
+    OrxExitListener(OIS::Keyboard *keyboard, Root* root)
   : mKeyboard(keyboard)
     {
+	root_ = root;
     }
 
     bool frameStarted(const FrameEvent& evt)
     {
+      moving(evt);
       mKeyboard->capture();
       return !mKeyboard->isKeyDown(OIS::KC_ESCAPE);
     }
+  
+    //code the movments of the nodes here
+    void moving(const FrameEvent& evt) {
+      SceneManager *mgr = root_->getSceneManager("Default SceneManager");
+      mgr->getSceneNode("HeadNode1")->yaw((Radian)10*evt.timeSinceLastFrame);
+    }
 
   private:
     OIS::Keyboard *mKeyboard;
+    Root* root_;
 };
 
@@ -199,5 +216,8 @@
       SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager");
       Camera *cam = mgr->createCamera("Camera");
+      cam->setPosition(Vector3(0,0,500));
+      cam->lookAt(Vector3(0,0,0));
       Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);
+      example();  //my stuff
     }
 
@@ -239,5 +259,5 @@
     void createFrameListener()
     {
-      mListener = new OrxExitListener(mKeyboard);
+      mListener = new OrxExitListener(mKeyboard, mRoot);
       mRoot->addFrameListener(mListener);
     }
@@ -247,5 +267,34 @@
       mRoot->startRendering();
     }
+
+    //declaration of the 3 Ogreheads
+    void example() {
+    SceneManager *mgr = mRoot->getSceneManager("Default SceneManager");
+    mgr->setAmbientLight(ColourValue(1.0,1.0,1.0));
+    Entity* ent1 = mgr->createEntity("Head1", "ogrehead.mesh");
+    Entity* ent2 = mgr->createEntity("Head2", "ogrehead.mesh");
+    Entity* ent3 = mgr->createEntity("Head3", "ogrehead.mesh");
+    SceneNode *node1 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode1", Vector3(0,0,0));
+    SceneNode *node2 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode2", Vector3(100,0,0));
+    SceneNode *node3 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode3", Vector3(-100,0,0));
+    node1->attachObject(ent1);
+    node2->attachObject(ent2);
+    node3->attachObject(ent3);
+    ElementLocationArray[0] = node1->getPosition();
+    ElementLocationArray[1] = node2->getPosition();
+    ElementLocationArray[2] = node3->getPosition();
+    ElementSpeedArray[0] = (0,0,0);
+    ElementSpeedArray[1] = (0,0,0);
+    ElementSpeedArray[2] = (0,0,0);
+    ElementAccelerationArray[0] = (0,0,0);
+    ElementAccelerationArray[1] = (0,0,0);
+    ElementAccelerationArray[2] = (0,0,0);
+    for (int i=0; i<3; i++) {
+      Element* arrayOfElements[i] = new element( ElementLocationArray[i], ElementSpeedArray[i], ElementAccelerationArray[i] );
+    }
+    }
 };
+
+
 
 #if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
