Index: /code/branches/AI/src/Flocking.h
===================================================================
--- /code/branches/AI/src/Flocking.h	(revision 232)
+++ /code/branches/AI/src/Flocking.h	(revision 233)
@@ -23,5 +23,5 @@
 
 
-  void element(Vector3 location_, Vector3 speed_, Vector3 acceleration_) {
+  Element(Vector3 location_, Vector3 speed_, Vector3 acceleration_) {
     acceleration = acceleration_;
     speed = speed_;
@@ -36,6 +36,6 @@
 
 //EINF[GEN DES ELEMENTS
-  void update(/*Element übergeben*/) {
-    calculateAcceleration(/*Elementübergabe*/);  //updates the acceleration
+  void update(Element* arrayOfElements) {
+    calculateAcceleration(arrayOfElements);  //updates the acceleration
     calculateSpeed();  //updates the speed
     calculateLocation();  //updates the location
@@ -43,12 +43,13 @@
 
 //EINF[GEN DES ELEMENTS
-  void calculateAcceleration(/*Element übergeben*/) {
+  void calculateAcceleration(Element* arrayOfElements) {
   //calculates the accelerationvector based on the steeringvectors of
   //separtion, alignment and cohesion.
-  acceleration = acceleration + separation() + alignment() + cohesion();
+  acceleration = acceleration + separation(arrayOfElements) + 2*alignment(arrayOfElements) + 2*cohesion(arrayOfElements);
   }
 
   void calculateSpeed() {
   speed = speed + acceleration;
+  //speed = speed.normalise();
   }
 
@@ -58,5 +59,5 @@
   }
 
-  Vector3 separation() {
+  Vector3 separation(Element* arrayOfElements) {
     Vector3 steering; //steeringvector
     int numberOfNeighbour;  //number of observed neighbours
@@ -64,10 +65,10 @@
     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
+      float distance = 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
+      if ((distance > 0) && (distance<1)) {  //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)
+        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
@@ -80,5 +81,5 @@
   }
 
-  Vector3 alignment() {
+  Vector3 alignment(Element* arrayOfElements) {
     Vector3 steering; //steeringvector
     int numberOfNeighbour;  //number of observed neighbours
@@ -86,7 +87,7 @@
     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
+      float distance = 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
+      if ((distance > 0) && (distance<1000)) {  //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
@@ -99,5 +100,5 @@
   }
 
-  Vector3 cohesion() {
+  Vector3 cohesion(Element* arrayOfElements) {
     Vector3 steering; //steeringvector
     int numberOfNeighbour;  //number of observed neighbours
@@ -105,7 +106,7 @@
     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
+      float distance = 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
+      if ((distance > 0) && (distance<1000)) {  //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
Index: /code/branches/AI/src/orxonox.cc
===================================================================
--- /code/branches/AI/src/orxonox.cc	(revision 232)
+++ /code/branches/AI/src/orxonox.cc	(revision 233)
@@ -82,4 +82,5 @@
 Vector3 ElementAccelerationArray[2];
 
+Element* arrayOfElements[2];
 
 
@@ -103,5 +104,11 @@
     void moving(const FrameEvent& evt) {
       SceneManager *mgr = root_->getSceneManager("Default SceneManager");
-      mgr->getSceneNode("HeadNode1")->yaw((Radian)10*evt.timeSinceLastFrame);
+      arrayOfElements[0]->update(*arrayOfElements);
+      mgr->getSceneNode("HeadNode1")->translate(0.000000001*evt.timeSinceLastFrame*arrayOfElements[0]->location);
+      arrayOfElements[1]->update(*arrayOfElements);
+      mgr->getSceneNode("HeadNode2")->translate(0.000000001*evt.timeSinceLastFrame*arrayOfElements[1]->location);
+      arrayOfElements[2]->update(*arrayOfElements);
+      mgr->getSceneNode("HeadNode3")->translate(0.000000001*evt.timeSinceLastFrame*arrayOfElements[2]->location);
+      //mgr->getSceneNode("HeadNode1")->yaw((Radian)10*evt.timeSinceLastFrame);
     }
 
@@ -216,5 +223,5 @@
       SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC, "Default SceneManager");
       Camera *cam = mgr->createCamera("Camera");
-      cam->setPosition(Vector3(0,0,500));
+      cam->setPosition(Vector3(0,0,1000));
       cam->lookAt(Vector3(0,0,0));
       Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);
@@ -269,4 +276,7 @@
 
     //declaration of the 3 Ogreheads
+   //muss leider global sein.....
+    //Element* arrayOfElements[2];
+
     void example() {
     SceneManager *mgr = mRoot->getSceneManager("Default SceneManager");
@@ -275,5 +285,5 @@
     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 *node1 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode1", Vector3(0,100,0));
     SceneNode *node2 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode2", Vector3(100,0,0));
     SceneNode *node3 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode3", Vector3(-100,0,0));
@@ -281,4 +291,6 @@
     node2->attachObject(ent2);
     node3->attachObject(ent3);
+    //Camera* cam  = mgr->getCamera("Camera");
+    //node1->attachObject(cam);
     ElementLocationArray[0] = node1->getPosition();
     ElementLocationArray[1] = node2->getPosition();
@@ -290,7 +302,17 @@
     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] );
-    }
+    arrayOfElements[0] = new Element( ElementLocationArray[0], ElementSpeedArray[0], ElementAccelerationArray[0] );
+    arrayOfElements[1] = new Element( ElementLocationArray[1], ElementSpeedArray[1], ElementAccelerationArray[1] );
+    arrayOfElements[2] = new Element( ElementLocationArray[2], ElementSpeedArray[2], ElementAccelerationArray[2] );
+
+
+
+
+   /* for (int i=0; i<3; i++) {
+      Element* arrayOfElements[i] = new Element( ElementLocationArray[i], ElementSpeedArray[i], ElementAccelerationArray[i] );
+    } */
+   /* for (int i=0; i<3; i++) {
+    arrayOfElements[i]->update(arrayOfElements);
+    }  */
     }
 };
