Index: code/branches/AI/src/orxonox.cc
===================================================================
--- code/branches/AI/src/orxonox.cc	(revision 468)
+++ code/branches/AI/src/orxonox.cc	(revision 495)
@@ -44,5 +44,5 @@
 #include "loader/LevelLoader.h"
 #include "Flocking.h"
-#include "AIClass.h"
+#include "Wander.h"
 
 // some tests to see if enet works without includsion
@@ -86,6 +86,8 @@
 
 Element arrayOfElements[9];
-
- // float time = 0;
+Wander walker;
+int counter = 0;
+int times = 0;
+
 
 
@@ -110,28 +112,35 @@
       SceneManager *mgr = root_->getSceneManager("Default SceneManager");
 
-      arrayOfElements[0].update(arrayOfElements, evt);
-      arrayOfElements[1].update(arrayOfElements, evt);
-      arrayOfElements[2].update(arrayOfElements, evt);
-      arrayOfElements[3].update(arrayOfElements, evt);
-      arrayOfElements[4].update(arrayOfElements, evt);
-      arrayOfElements[5].update(arrayOfElements, evt);
-      arrayOfElements[6].update(arrayOfElements, evt);
-      arrayOfElements[7].update(arrayOfElements, evt);
-      arrayOfElements[8].update(arrayOfElements, evt);
-
- /*   arrayOfElements[0].update(arrayOfElements, evt);
-      arrayOfElements[1].update(arrayOfElements, evt);
-      arrayOfElements[2].update(arrayOfElements, evt);
-      arrayOfElements[3].update(arrayOfElements, evt);
-      arrayOfElements[4].update(arrayOfElements, evt);   */
-
+/*    // RUN WANDER
+
+      walker.update();
+      walker.speed = walker.speed + 10*walker.acceleration*evt.timeSinceLastFrame;
+      walker.location = walker.location + 10*walker.speed*evt.timeSinceLastFrame;
+      walker.acceleration  = (0,0,0);
+      mgr->getSceneNode("HeadNode10")->setPosition(walker.location);
+
+*/   // END RUN WANDER
+
+
+
+
+     //  RUN FLOCKING
+
+      arrayOfElements[8].location = 100*Vector3(Math::Cos(Math::DegreesToRadians(counter)/10),Math::Sin(Math::DegreesToRadians(counter)/10),Math::Cos(Math::DegreesToRadians(counter+(counter-180)/2)/10));
+
+      arrayOfElements[0].update(arrayOfElements);
+      arrayOfElements[1].update(arrayOfElements);
+      arrayOfElements[2].update(arrayOfElements);
+      arrayOfElements[3].update(arrayOfElements);
+      arrayOfElements[4].update(arrayOfElements);
+      arrayOfElements[5].update(arrayOfElements);
+      arrayOfElements[6].update(arrayOfElements);
+      arrayOfElements[7].update(arrayOfElements);
+      arrayOfElements[8].update(arrayOfElements);
 
       for(int i=0; i<9; i++) {
-
-         arrayOfElements[i].speed = 0.995*arrayOfElements[i].speed + arrayOfElements[i].acceleration*evt.timeSinceLastFrame;
-
-         arrayOfElements[i].location = arrayOfElements[i].location + arrayOfElements[i].speed*evt.timeSinceLastFrame;
-
-         arrayOfElements[i].acceleration  = (0,0,0);
+        arrayOfElements[i].speed = 0.995*arrayOfElements[i].speed + arrayOfElements[i].acceleration*evt.timeSinceLastFrame;
+        arrayOfElements[i].location = arrayOfElements[i].location + arrayOfElements[i].speed*evt.timeSinceLastFrame;
+        arrayOfElements[i].acceleration  = (0,0,0);
       }
 
@@ -146,15 +155,9 @@
       mgr->getSceneNode("HeadNode9")->setPosition(arrayOfElements[8].location);
 
-
-      /*
-
-      mgr->getSceneNode("HeadNode9")->setPosition(Vector3(200*cos(10*time),0,0));
-      time = time + evt.timeSinceLastFrame;
-
-     */
-
-
-
-    //  mgr->getSceneNode("HeadNode1")->yaw((Radian)10*evt.timeSinceLastFrame);
+      counter = counter + 1;
+      counter = counter%7200;
+
+      // END RUN FLOCKING 
+
     }
 
@@ -272,5 +275,7 @@
       cam->lookAt(Vector3(0,0,0));
       Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);
-      example();  //my stuff
+
+      //Invoke example to test AI
+      example();
     }
 
@@ -321,11 +326,21 @@
     }
 
-    //declaration of the 3 Ogreheads
-   //muss leider global sein.....
-    //Element* arrayOfElements[2];
-
     void example() {
     SceneManager *mgr = mRoot->getSceneManager("Default SceneManager");
     mgr->setAmbientLight(ColourValue(1.0,1.0,1.0));
+
+/*  //TEST DATA WANDER
+
+    Entity* ent10 = mgr->createEntity("Head10", "ogrehead.mesh");
+    SceneNode *node10 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode10", Vector3(0,0,0));
+    node10->attachObject(ent10);
+    Vector3 temp;
+    temp = (0,0,0);
+    walker.setValues(node10->getPosition(),temp,temp,true);
+
+*/  //END TEST DATA WANDER
+
+
+//   TEST DATA FLOCKING
 
     Entity* ent1 = mgr->createEntity("Head1", "ogrehead.mesh");
@@ -347,13 +362,5 @@
     SceneNode *node7 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode7", Vector3(-150,-150,0));
     SceneNode *node8 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode8", Vector3(-150,150,0));
-    SceneNode *node9 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode9", Vector3(0,0,0));  
-
-// follwing camera
-
- //  Camera *cam = mgr->getCamera("Camera");
- //  node1->attachObject(cam);
-
-
-
+    SceneNode *node9 = mgr->getRootSceneNode()->createChildSceneNode("HeadNode9", Vector3(0,0,0));
 
     node1->attachObject(ent1);
@@ -376,7 +383,5 @@
     ElementLocationArray[7] = node8->getPosition();
     ElementLocationArray[8] = node9->getPosition();
-/*
-ElementLocationArray[5] = node6->getPosition();
-ElementLocationArray[6] = node7->getPosition();*/
+
     ElementSpeedArray[0] = (0,0,0);
     ElementSpeedArray[1] = (0,0,0);
@@ -388,7 +393,5 @@
     ElementSpeedArray[7] = (0,0,0);
     ElementSpeedArray[8] = (0,0,0);
-/*
-ElementSpeedArray[5] = (0,0,0);
-ElementSpeedArray[6] = (0,0,0); */
+
     ElementAccelerationArray[0] = (0,0,0);
     ElementAccelerationArray[1] = (0,0,0);
@@ -400,7 +403,5 @@
     ElementAccelerationArray[7] = (0,0,0);
     ElementAccelerationArray[8] = (0,0,0);
-/*
-ElementAccelerationArray[5] = (0,0,0);
-ElementAccelerationArray[6] = (0,0,0); */
+
     arrayOfElements[0].setValues( ElementLocationArray[0], ElementSpeedArray[0], ElementAccelerationArray[0], true);
     arrayOfElements[1].setValues( ElementLocationArray[1], ElementSpeedArray[1], ElementAccelerationArray[1], true);
@@ -412,21 +413,6 @@
     arrayOfElements[7].setValues( ElementLocationArray[7], ElementSpeedArray[7], ElementAccelerationArray[7], true);
     arrayOfElements[8].setValues( ElementLocationArray[8], ElementSpeedArray[8], ElementAccelerationArray[8], false);
-/*
-arrayOfElements[5].setValues( ElementLocationArray[5], ElementSpeedArray[5], ElementAccelerationArray[5], false);
-arrayOfElements[6].setValues( ElementLocationArray[6], ElementSpeedArray[6], ElementAccelerationArray[6], false);*/
-
-
-
-
-   /* 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);
-    }  */
-
-//testing AIPilot -> function steer
-  //  AIPilot temp;
-  //  Vector3 foo = temp.steer(Vector3(0,0,1));
+
+   // END TEST DATA FLOCKING
 
 
