Index: code/branches/AI_HS15/data/levels/AITest.oxw
===================================================================
--- code/branches/AI_HS15/data/levels/AITest.oxw	(revision 10804)
+++ code/branches/AI_HS15/data/levels/AITest.oxw	(revision 10805)
@@ -1,5 +1,5 @@
 <LevelInfo
- name = "AI testing level"
- description = "A level with two opposing AI teams"
+ name = "New AI testing level"
+ description = "A level with two opposing new AI teams"
  tags = "test"
  screenshot = "emptylevel.png"
@@ -33,241 +33,12 @@
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
     <SpawnPoint team=0 position="-1000,-1000,-1000" lookat="1,1,-1" spawnclass=SpaceShip pawndesign=spaceshipassff />
-    <!-->
-
+    >
+<!-- 
     <?lua
       for i = 0, 5, 1 do
     ?>
 
-    <StaticEntity position="0,-10000,0" direction="0,-1,0" >
-     <controller>
-        <FleetController team=1>
-        </FleetController>
-      </controller>
-    </StaticEntity>
-    <StaticEntity position="0,10000,0" direction="0,-1,0" >
-     <controller>
-        <FleetController team=2>
-        </FleetController>
-      </controller>
-    </StaticEntity>
-    <SpaceShip position="<?lua print(1600+i*200) ?>,<?lua print(3000-i*500) ?>, -1500 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <AIController accuracy=10 team=1>
-        </AIController>
-      </controller>
-    </SpaceShip>
-    <?lua end ?>
-  </!-->
-    <SpaceShip position="0,-10000,0" direction="0,-1,0" >
-     <templates>
-        <Template link=spaceshipassff />
-      </templates>
-     <controller>
-        <FleetController team=1>
-        </FleetController>
-      </controller>
-    </SpaceShip>
-    <?lua
-      for i = 0, 0, 1 do
-    ?>
-
-    
-    <SpaceShip position="<?4000 ?>,<?lua print(1500+i*1000) ?>, -1000 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <DivisionController team=1 formationMode="DIAMOND">
-        </DivisionController>
-      </controller>
-    </SpaceShip>
-    <!-- <SpaceShip position="<?1000 ?>,<?lua print(1500+i*1000) ?>, -1600 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=1>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="<?1000 ?>,<?lua print(1500+i*1000) ?>, -2200 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=1>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="<?1000 ?>,<?lua print(1500+i*1000) ?>, -2800 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <SectionController team=1>
-        </SectionController>
-      </controller>
-    </SpaceShip> -->
-    <?lua end ?>
-   <!--  <SpaceShip position="4000, 1500, -1300 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=2>
-        </WingmanController>
-      </controller>
-    </SpaceShip> -->
-<!-- 
-    <?lua
-      for i = 0, 0, 1 do
-    ?>
-
-    <StaticEntity position="1000,-10000,0" direction="0,-1,0" >
-     <controller>
-        <FleetController team=2>
-        </FleetController>
-      </controller>
-    </StaticEntity>
-    <SpaceShip position="<?50000 ?>,<?lua print(1500+i*1000) ?>, -1000 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <DivisionController team=2>
-        </DivisionController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="<?50000 ?>,<?lua print(1500+i*1000) ?>, -1600 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=2>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="<?50000 ?>,<?lua print(1500+i*1000) ?>, -2200 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=2>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="<?50000 ?>,<?lua print(1500+i*1000) ?>, -2800 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <SectionController team=2>
-        </SectionController>
-      </controller>
-    </SpaceShip>
-    <?lua end ?> -->
-
-<!-- 
-
-    <StaticEntity position = "-1000, -1000, -1000">
- 
-      <controller>
-        <FleetController accuracy=10 team=1 >
-        </FleetController>
-      </controller>
-    </StaticEntity>
-    
-    <SpaceShip position="1000, 1000, -1300 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <DivisionController team=1>
-        </DivisionController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="1000, 1500, -1300 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=1>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="1000, 1500, -1700 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=1>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="1000, 1000, -1900 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <SectionController team=1>
-        </SectionController>
-      </controller>
-    </SpaceShip>
-
-
-      <StaticEntity position = "-1000, -1000, -2000">
- 
-      <controller>
-        <FleetController accuracy=10 team=2 >
-        </FleetController>
-      </controller>
-    </StaticEntity>
-    
-    <SpaceShip position="4000, 1000, -1300 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <DivisionController team=2>
-        </DivisionController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="4000, 1500, -1300 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=2>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="4000, 1500, -1700 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <WingmanController team=2>
-        </WingmanController>
-      </controller>
-    </SpaceShip>
-    <SpaceShip position="4000, 1000, -1900 ?>" lookat="0,0,0">
-      <templates>
-        <Template link=spaceshipassff />
-      </templates>
-      <controller>
-        <SectionController team=2>
-        </SectionController>
-      </controller>
-    </SpaceShip> -->
-
-   
-    <!-->
-    <?lua
-      for i = 0, 5, 1 do
-    ?>
-    <SpaceShip position="<?lua print(1600+i*200) ?>,3000, 6000 ?>" lookat="0,0,0">
+    
+    <SpaceShip position="<?lua print(-1600+i*200) ?>,<?lua print(-3000-i*500) ?>, -1500 ?>" lookat="0,0,0">
       <templates>
         <Template link=spaceshipassff />
@@ -278,6 +49,158 @@
       </controller>
     </SpaceShip>
-    <?lua end ?>
-    </!-->
+    <?lua end ?> -->
+ 
+    
+    <SpaceShip position="4000, 1500, -1000" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <DivisionController team=1 formationMode="DIAMOND">
+        </DivisionController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="4000 ,1500, -1600 " lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WingmanController team=1>
+        </WingmanController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="4000, 1500, -2200" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WingmanController team=1>
+        </WingmanController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="6000, 1500, -2800" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <SectionController team=1>
+        </SectionController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="6000, 1500, -1000" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <DivisionController team=1 formationMode="DIAMOND">
+        </DivisionController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="6000 ,1500, -1600 " lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WingmanController team=1>
+        </WingmanController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="6000, 1500, -2200" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WingmanController team=1>
+        </WingmanController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="6000, 1500, -2800" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <SectionController team=1>
+        </SectionController>
+      </controller>
+    </SpaceShip>
+  
+    
+    <SpaceShip position="-4000, 1500, -5000" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <DivisionController team=2 formationMode="FINGER4">
+        </DivisionController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="-4000 , 1500, -5600" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WingmanController team=2>
+        </WingmanController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="-4000, 1500, -6200" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WingmanController team=2>
+        </WingmanController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="-4000, 1500, -6800 " lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <SectionController team=2>
+        </SectionController>
+      </controller>
+    </SpaceShip>
+
+       <SpaceShip position="-6000, 1500, -5000" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <DivisionController team=2 formationMode="FINGER4">
+        </DivisionController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="-6000 , 1500, -5600" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WingmanController team=2>
+        </WingmanController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="-6000, 1500, -6200" lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <WingmanController team=2>
+        </WingmanController>
+      </controller>
+    </SpaceShip>
+    <SpaceShip position="-6000, 1500, -6800 " lookat="0,0,0">
+      <templates>
+        <Template link=spaceshipassff />
+      </templates>
+      <controller>
+        <SectionController team=2>
+        </SectionController>
+      </controller>
+    </SpaceShip>
+
+
+    
+   
 
   </Scene>
Index: code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	(revision 10804)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	(revision 10805)
@@ -55,4 +55,5 @@
         this->executingManeuver_ = false;
         this->executingMoveToPoint_ = false;
+        this->action_ = Action::FLY;
         this->stopLookingAtTarget();
         this->maneuverType_ = ManeuverType::NONE;
@@ -63,4 +64,5 @@
     CommonController::~CommonController() 
     {
+        orxout(internal_error) << "I died, my Rank is " << rank_ << endl;
     }
 
@@ -118,4 +120,46 @@
         }
     }
+    Action::Value CommonController::getAction ()
+    {
+        return this->action_;
+    }
+
+    void CommonController::setAction (Action::Value action, ControllableEntity* target)
+    {
+        this->action_ = action;
+        if (action == Action::FIGHT)
+        {   
+            if (target)
+                this->setTarget (target);
+        }
+        else if (action == Action::PROTECT)
+        {
+        }
+    }
+    void CommonController::setAction (Action::Value action, const Vector3& target)
+    {
+        this->action_ = action;
+        if (action == Action::FLY)
+        {
+            this->setTargetPosition (target);
+        }
+        else if (action == Action::PROTECT)
+        {
+
+        }
+    }
+    void CommonController::setAction (Action::Value action, const Vector3& target,  const Quaternion& orient )
+    {
+        this->action_ = action;
+        if (action == Action::FLY)
+        {
+            this->setTargetPosition (target);
+            this->setTargetOrientation (orient);
+        }
+        else if (action == Action::PROTECT)
+        {
+            
+        }
+    }
     void CommonController::maneuver() 
     {
@@ -145,26 +189,25 @@
 
             //bool bThisIsLookingAtTarget = this->isLooking ( getControllableEntity(), this->target_, math::pi/4 );
-            bool bTargetIsLookingAtThis = this->isLooking ( this->target_, getControllableEntity(), math::pi/8.0f );
+            bool bTargetIsLookingAtThis = this->isLooking ( this->target_, getControllableEntity(), math::pi/5.0f );
             
 
 
             //too far? well, come closer then
-            if ( diffLength > 5000 )
+            if ( diffLength > 3000 )
             {
                 if (diffLength < 6000)
                 {
-                    this->bEngaging_ = true;
+
                 }
                 else
                 {
-                    this->bEngaging_ = false;
                 }
                 this->setTargetPosition( this->positionOfTarget_ );
             }
             //too close? How do u expect to dodge anything? Just attack!
-            else if ( diffLength < 600 )
+            else if ( diffLength < 500 )
             {   
                 //at this point, just look and shoot
-                if ( diffLength < 300 )
+                if ( diffLength < 250 )
                 {
                     this->stopMoving();
@@ -205,8 +248,8 @@
         if ( this->getControllableEntity()  && !this->target_ )
         {
-            this->bEngaging_ = false;
+
             this->maneuverType_ = ManeuverType::NONE;
         }
-        orxout ( internal_error ) << "ManeuverType = " << this->maneuverType_ << endl;
+        //orxout ( internal_error ) << "ManeuverType = " << this->maneuverType_ << endl;
     }
     ControllableEntity* CommonController::getTarget()
@@ -305,5 +348,5 @@
     {
         this->target_ = target;
-        orxout ( internal_error ) << " TARGET SET " << endl;
+        //orxout ( internal_error ) << " TARGET SET " << endl;
         
         if ( this->target_ )
@@ -376,11 +419,5 @@
     void CommonController::moveToPosition( const Vector3& target, float dt )
     {
-        float factor = 1;
-        if ( !this->getControllableEntity() )
-            return;
-        if ( this->rank_ == Rank::DIVISIONLEADER )
-            factor = 0.9;
-        if ( this->rank_ == Rank::SECTIONLEADER )
-            factor = 0.95;
+     
         
         //100 is ( so far )the smallest tolerance ( empirically found )that can be reached, 
@@ -421,5 +458,5 @@
             }
 
-            this->getControllableEntity() ->moveFrontBack( SPEED*factor * dt );
+            this->getControllableEntity() ->moveFrontBack( SPEED * dt );
         }
         else
@@ -560,5 +597,5 @@
         float squaredDistance = squaredDistanceToTarget();
 
-        if ( squaredDistance < 25000000.0f && this->isLookingAtTarget( math::pi / 10.0f)) {
+        if ( squaredDistance < 9000000.0f && this->isLookingAtTarget( math::pi / 10.0f)) {
             return true;
         }
Index: code/branches/AI_HS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	(revision 10804)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	(revision 10805)
@@ -65,4 +65,11 @@
         };
 
+    }
+    namespace Action
+    {  
+        enum Value
+        {
+            FLY, FIGHT, PROTECT
+        };
     }
     //none for a formation flight
@@ -121,5 +128,8 @@
             /*void spin();
             void turn180();*/
-
+            Action::Value getAction ();
+            void setAction (Action::Value action, ControllableEntity* target);
+            void setAction (Action::Value action, const Vector3& target);
+            void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
 
         protected:
@@ -158,4 +168,8 @@
             Quaternion targetOrientation_;
 
+            Vector3 destination_;
+            bool bHasDestination;
+
+
             void stopMoving();
             void setPositionOfTarget(const Vector3& target);
@@ -170,4 +184,7 @@
             //WeakPtr<ControllableEntity> thisEntity_;
 
+           
+
+            Action::Value action_;
             bool bEngaging_;
             bool bShooting_;
Index: code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc	(revision 10804)
+++ code/branches/AI_HS15/src/orxonox/controllers/DivisionController.cc	(revision 10805)
@@ -51,5 +51,4 @@
     DivisionController::~DivisionController()
     {
-      
     } 
 
@@ -77,7 +76,48 @@
     void DivisionController::action()
     {
-        this->maneuver();
-        this->bShooting_ = this->canFire();
-        
+        if (!this->target_)
+        {
+            for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+            {
+                if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam())
+                    continue;           
+
+                
+                if (static_cast<ControllableEntity*>(*itP) != (this)->getControllableEntity() && !(this)->hasTarget()
+                    && ((*itP)->getWorldPosition() - (this)->getControllableEntity()->getWorldPosition()).length() < 10000)
+                {
+                    (this)->setAction(Action::FIGHT, *itP);
+                }   
+            }
+        }
+        
+        if (this->action_ == Action::FIGHT)
+        {
+            this->maneuver();
+            this->bShooting_ = this->canFire();
+            if (this->target_)
+            {
+                if (this->myWingman_)
+                {
+                    this->myWingman_->setAction (Action::FIGHT, this->target_);                    
+                }
+                
+                Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
+                if (diffVector.length() > 3000)
+                {
+                    this->setTargetPositionOfWingman();
+                    //this->setTargetPositionOfFollower();                    
+                }   
+            }
+        }
+        else if (this->action_ == Action::FLY)
+        {
+            this->setTargetPositionOfWingman();
+            this->setTargetPositionOfFollower();
+        }
+        else if (this->action_ == Action::PROTECT)
+        {
+
+        }
 
     }
@@ -116,6 +156,5 @@
         (this->getControllableEntity()->getWorldOrientation()* (*targetRelativePositionOfWingman)));
         
-        myWingman_->setTargetOrientation(orient);
-        myWingman_->setTargetPosition(targetAbsolutePositionOfWingman);
+        myWingman_->setAction( Action::FLY, targetAbsolutePositionOfWingman, orient);
        
     }
@@ -153,7 +192,5 @@
         (this->getControllableEntity()->getWorldOrientation()* (*targetRelativePositionOfFollower)));
         
-        myFollower_->setTargetOrientation(orient);
-        myFollower_->setTargetPosition(targetAbsolutePositionOfFollower);
-       
+        myFollower_->setAction ( Action::FLY, targetAbsolutePositionOfFollower, orient );       
     }
 
Index: code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc	(revision 10804)
+++ code/branches/AI_HS15/src/orxonox/controllers/FleetController.cc	(revision 10805)
@@ -87,7 +87,8 @@
             for(std::vector<WeakPtr<DivisionController> >::iterator it = divisions_.begin(); it != divisions_.end(); ++it) 
             {
-                if (static_cast<ControllableEntity*>(*itP) != (*it)->getControllableEntity() && !(*it)->hasTarget())
+                if (static_cast<ControllableEntity*>(*itP) != (*it)->getControllableEntity() && !(*it)->hasTarget()
+                    && ((*itP)->getWorldPosition() - (*it)->getControllableEntity()->getWorldPosition()).length() < 10000)
                 {
-                    (*it)->setTarget(*itP);
+                    (*it)->setAction(Action::FIGHT, *itP);
                 }
                 
@@ -95,5 +96,10 @@
            
         }
-
+        /*for(std::vector<WeakPtr<DivisionController> >::iterator it = divisions_.begin(); it != divisions_.end(); ++it) 
+        {
+            Vector3* target = new Vector3 (0, 0, 2000);
+            (*it)->setAction (Action::FLY, *target);           
+        }   
+*/
     }
     void FleetController::tick(float dt)
Index: code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc	(revision 10804)
+++ code/branches/AI_HS15/src/orxonox/controllers/SectionController.cc	(revision 10805)
@@ -55,14 +55,18 @@
     void SectionController::tick(float dt)
     {
-        if (!this->isActive())
+         if (!this->isActive())
             return;
-        
-        
         if (this->bHasTargetPosition_)
         {
             this->moveToTargetPosition(dt);
         }
-        if (this->bShooting_)
-            doFire();
+        else if (this->bLookAtTarget_)
+        {
+            this->lookAtTarget(dt);
+        }
+        if (bShooting_)
+        {
+            this->doFire();
+        }
         
         SUPER(SectionController, tick, dt);
@@ -80,15 +84,79 @@
             else
             {
-                
-            }
-
-        }
-        setTargetPositionOfWingman();
-        if (this->target_ && this->myWingman_)
-            this->myWingman_->setTarget(this->target_);
-        if (canFire())
-           this->bShooting_ = true;
+                for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                {
+                    if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam())
+                        continue;           
+
+                    if (!this->myDivisionLeader_)
+                    {
+                        this->setAction(Action::FIGHT, (*itP));
+                        break;
+                    }
+                   
+                }
+            }
+
+        }
         else
-            this->bShooting_ = false;
+        {
+            if (this->myDivisionLeader_->getAction() == Action::FIGHT)
+            {
+                if (this->myDivisionLeader_->hasTarget())
+                {
+                    if (this->myDivisionLeader_->hasWingman() && (!this->hasTarget() || this->getTarget() == this->myDivisionLeader_->getTarget()))
+                    {
+                        bool foundTarget = false;
+                        Vector3 divisionTargetPosition = this->myDivisionLeader_->getTarget()->getWorldPosition();
+                        for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                        {
+                            if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam())
+                                continue;           
+
+                            if (((*itP)->getWorldPosition() - divisionTargetPosition).length() < 3000 &&
+                                ((*itP)->getWorldPosition() - divisionTargetPosition).length() > 1000 && 
+                                (*itP) != this->myDivisionLeader_->getTarget())
+                            {
+                                foundTarget = true;
+                                this->setAction(Action::FIGHT, (*itP));
+                                orxout(internal_error) << "Found target" << endl;
+                                break; 
+                            }
+                        }
+                        if (!foundTarget)
+                        {
+                            this->setAction(Action::FIGHT, this->myDivisionLeader_->getTarget());
+                        }
+
+                    }
+                }
+            }   
+        }
+        
+        if (this->action_ == Action::FIGHT)
+        {
+            this->maneuver();
+            this->bShooting_ = this->canFire();
+            if (this->target_)
+            {
+                if (this->myWingman_)
+                {
+                    this->myWingman_->setAction (Action::FIGHT, this->target_);                    
+                }
+                Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
+                if (diffVector.length() > 3000)
+                {
+                    this->setTargetPositionOfWingman();
+                }   
+            }
+        }
+        else if (this->action_ == Action::FLY)
+        {
+            this->setTargetPositionOfWingman();
+        }
+        else if (this->action_ == Action::PROTECT)
+        {
+
+        }
                 
 
@@ -126,6 +194,5 @@
         (this->getControllableEntity()->getWorldOrientation()* (*targetRelativePositionOfWingman)));
         
-        myWingman_->setTargetOrientation(orient);
-        myWingman_->setTargetPosition(targetAbsolutePositionOfWingman);
+        myWingman_->setAction (Action::FLY, targetAbsolutePositionOfWingman, orient);
        
     }
Index: code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc	(revision 10804)
+++ code/branches/AI_HS15/src/orxonox/controllers/WingmanController.cc	(revision 10805)
@@ -111,23 +111,18 @@
     void WingmanController::tick(float dt)
     {   
-       
-        
         if (!this->isActive())
             return;
-        if (!this->target_)
-        {
-            //stay in formation
-        }
-        else
-        {
-
-        }
         if (this->bHasTargetPosition_)
         {
             this->moveToTargetPosition(dt);
-        } 
-        
-        if (this->bShooting_)
-            doFire();
+        }
+        else if (this->bLookAtTarget_)
+        {
+            this->lookAtTarget(dt);
+        }
+        if (bShooting_)
+        {
+            this->doFire();
+        }
         
         SUPER(WingmanController, tick, dt);
@@ -144,6 +139,13 @@
             else
             {
-                //orxout(internal_error) << "0 leader" << endl;
-                
+                if (!this->target_){
+                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
+                    {
+                        if (this->getControllableEntity()->getTeam() == static_cast<ControllableEntity*>(*itP)->getTeam())
+                            continue;   
+                        this->setAction(Action::FIGHT, (*itP));
+                        break;
+                    }
+                }
             }
 
@@ -153,8 +155,26 @@
 
         }
-        if (canFire())
-           this->bShooting_ = true;
-        else
-            this->bShooting_ = false;
+        
+        if (this->action_ == Action::FIGHT)
+        {
+            this->maneuver();
+            this->bShooting_ = this->canFire();
+            if (this->target_)
+            {
+                Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
+                if (diffVector.length() > 5000)
+                {
+                  
+                }   
+            }
+        }
+        else if (this->action_ == Action::FLY)
+        {
+
+        }
+        else if (this->action_ == Action::PROTECT)
+        {
+
+        }
           
     }
