Index: /code/branches/campaignHS15/data/levels/AITest.oxw
===================================================================
--- /code/branches/campaignHS15/data/levels/AITest.oxw	(revision 10878)
+++ /code/branches/campaignHS15/data/levels/AITest.oxw	(revision 10879)
@@ -62,5 +62,5 @@
 <!-- HERE STARTS DEMO FOR THE ACTIONPOINTS. 
 P.S. Never set protectMe in the first actionpoint: if human didn't spawn, that actionpoint will be skipped -->
-       
+     <!--   
     <Model mesh="cube.mesh" scale=8 position="0,0,0" />
 
@@ -123,5 +123,5 @@
       </templates>
     </SpaceShip> 
- 
+  -->
    
 <!-- HERE ENDS DEMO FOR THE ACTIONPOINTS -->
@@ -210,5 +210,5 @@
 <!-- HERE ENDS DEMO FOR FIGHTING -->
 <!-- HERE STARTS DEMO FOR FORMATIONS -->
-    <!-- 
+    
     <Model mesh="cube.mesh" scale=8 position="   0,2000,    0" />
     <Model mesh="cube.mesh" scale=8 position="   0,2000,-2000" />
@@ -221,5 +221,5 @@
       </templates>
       <controller>
-        <DivisionController team=0 formationMode="DIAMOND" spread=100>
+        <DivisionController team=0 formationMode="Finger4" spread=100>
           <actionpoints>
             <Actionpoint position="   0,2000,    0" action="FLY" loopStart=true/>
@@ -259,5 +259,5 @@
       </controller>
     </SpaceShip> 
-    -->
+   
 <!-- HERE ENDS DEMO FOR FORMATIONS -->
     <!-- 
Index: /code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10878)
+++ /code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc	(revision 10879)
@@ -82,5 +82,12 @@
         }
         if (this->bFirstTick_)
+        {
+            // this->getControllableEntity()->setOrientation(1,0,0,0);
+            // this->getControllableEntity()->rotateRoll(-this->getControllableEntity()->getOrientation().getRoll(true).valueRadians());
+            // this->getControllableEntity()->rotateYaw(-this->getControllableEntity()->getOrientation().getYaw(true).valueRadians());
+            // this->getControllableEntity()->rotatePitch(-this->getControllableEntity()->getOrientation().getPitch(true).valueRadians());            
             this->bFirstTick_ = false;
+
+        }
    		SUPER(ActionpointController, tick, dt);
    	}
@@ -358,4 +365,5 @@
             (this->getProtect()->getWorldOrientation()* (*targetRelativePosition)));
         this->setTargetPosition(targetAbsolutePosition);
+        this->setTargetOrientation(this->getProtect()->getWorldOrientation());
     }
     void ActionpointController::nextActionpoint()
Index: /code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc	(revision 10878)
+++ /code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc	(revision 10879)
@@ -30,5 +30,5 @@
 #include "worldentities/pawns/SpaceShip.h"
 #include "util/Math.h"
-
+#include <OgreMatrix3.h>
 namespace orxonox
 {    
@@ -37,4 +37,5 @@
     FlyingController::FlyingController( Context* context ): CommonController( context )
     {
+        this->rotationProgress_ = 0;
         this->spread_ = 200;
         this->tolerance_ = 80;
@@ -108,13 +109,13 @@
             this->getControllableEntity() ->rotatePitch( ROTATEFACTOR * rotateY * dt );
 
-            if ( distance < 300 )
-            {
-                if ( bHasTargetOrientation_ )
-                {
-                    copyTargetOrientation( dt );
-                }
-            }
+          
             if (distance > this->tolerance_*1.5f || (rotateX > -0.01 && rotateX < 0.01 && rotateY > -0.01 && rotateY < 0.01))
                 this->getControllableEntity() ->moveFrontBack( SPEED * dt );
+          
+            // if ( bHasTargetOrientation_ && (rotateX > -0.005 && rotateX < 0.005 && rotateY > -0.005 && rotateY < 0.005) )
+            // {
+                copyTargetOrientation( dt );
+            // }
+            
         }
         else
@@ -130,11 +131,32 @@
     void FlyingController::copyOrientation( const Quaternion& orient, float dt )
     {
-
-        double diff=orient.getRoll(false).valueRadians() -
-                        ( this->getControllableEntity() ->getOrientation() .getRoll( false ).valueRadians() );
-        while( diff>math::twoPi)diff-=math::twoPi;
-        while( diff<-math::twoPi )diff+=math::twoPi;
-
-        this->getControllableEntity() ->rotateRoll(diff * ROTATEFACTOR * dt);
+        //inspired by
+        //http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Quaternion+and+Rotation+Primer&structure=Tutorials#Q._How_can_I_make_my_objects_rotate_smoothly_You_mentioned_slerp_etc_
+        //how can I make my objects rotate smoothly?
+       
+        Quaternion myOrient = this->getControllableEntity()->getOrientation();
+        this->rotationProgress_ += dt/50.0f;
+
+        if (this->rotationProgress_ > 1)
+        {
+            this->rotationProgress_ = 0;
+        }
+        else
+        {
+            Quaternion delta = Quaternion::Slerp(this->rotationProgress_, myOrient, orient, true);
+      
+            Matrix3 orientMatrix, myMatrix;
+            delta.ToRotationMatrix(orientMatrix);
+            myOrient.ToRotationMatrix (myMatrix);
+
+            Radian yRad, pRad, rRad, yMy, pMy, rMy;
+            orientMatrix.ToEulerAnglesYXZ(yRad, pRad, rRad);
+            myMatrix.ToEulerAnglesYXZ (yMy, pMy, rMy);
+            orxout (internal_error) << "dt = " << dt << endl;
+            this->getControllableEntity()->rotateRoll (50.0f*dt*(rRad.valueRadians() - rMy.valueRadians()));
+            //this->getControllableEntity()->setOrientation(delta);
+        }
+        //this shit works. How? 
+        
     }
     //change log: increased precision, increased rotation speed
Index: /code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h	(revision 10878)
+++ /code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h	(revision 10879)
@@ -82,5 +82,5 @@
             FormationMode::Value formationMode_;
           
-  
+            float rotationProgress_;
             bool bHasTargetPosition_;
             Vector3 targetPosition_;
Index: /code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc	(revision 10878)
+++ /code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc	(revision 10879)
@@ -83,5 +83,74 @@
             Action::FIGHTALL && this->myDivisionLeader_->getAction() != Action::ATTACK)
         {
-            ControllableEntity* myEntity = this->getControllableEntity();
+            
+        }    
+        SUPER(SectionController, tick, dt);
+    }
+
+    void SectionController::action()
+    {
+        if (!this || !this->getControllableEntity())
+            return;
+
+        //----If no leader, find one----  
+        if (!myDivisionLeader_)
+        {
+            LeaderController* newDivisionLeader = findNewDivisionLeader();
+            this->myDivisionLeader_ = newDivisionLeader;
+            if (this->myDivisionLeader_)
+            {
+
+            }
+        }
+        //----If have leader----
+        else
+        {
+        }
+        if (!myDivisionLeader_)
+        {
+            
+            ActionpointController::action();
+            if (!this || !this->getControllableEntity())
+                return;
+            if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
+            {
+                if (this->myWingman_)
+                {
+                    this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
+                }    
+            }
+        }
+        else if (myDivisionLeader_)
+        {
+            switch (myDivisionLeader_->getAction())
+            {
+                case Action::FIGHT:
+                {
+                    if (!this->hasTarget())
+                    {
+                        this->chooseTarget();
+                    }
+                    break;
+                }
+                case Action::FIGHTALL:
+                {
+                    if (!this->hasTarget())
+                    {
+                        this->chooseTarget();
+                    }
+                    break;
+                }
+                case Action::ATTACK:
+                {
+                    if (!this->hasTarget())
+                    {
+                        this->chooseTarget();
+                    }
+                    break;
+                }
+                default:
+                {
+                    //formation flight is executed in tick
+                    ControllableEntity* myEntity = this->getControllableEntity();
             Vector3 myPosition = myEntity->getWorldPosition();
             if (!this->myDivisionLeader_)
@@ -111,69 +180,4 @@
                this->getControllableEntity()->boost(false);
             }
-        }    
-        SUPER(SectionController, tick, dt);
-    }
-
-    void SectionController::action()
-    {
-        if (!this || !this->getControllableEntity())
-            return;
-
-        //----If no leader, find one----  
-        if (!myDivisionLeader_)
-        {
-            LeaderController* newDivisionLeader = findNewDivisionLeader();
-            this->myDivisionLeader_ = newDivisionLeader;
-
-        }
-        //----If have leader----
-        else
-        {
-        }
-        if (!myDivisionLeader_)
-        {
-            
-            ActionpointController::action();
-            if (!this || !this->getControllableEntity())
-                return;
-            if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
-            {
-                if (this->myWingman_)
-                {
-                    this->myWingman_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
-                }    
-            }
-        }
-        else if (myDivisionLeader_)
-        {
-            switch (myDivisionLeader_->getAction())
-            {
-                case Action::FIGHT:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->chooseTarget();
-                    }
-                    break;
-                }
-                case Action::FIGHTALL:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->chooseTarget();
-                    }
-                    break;
-                }
-                case Action::ATTACK:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->chooseTarget();
-                    }
-                    break;
-                }
-                default:
-                {
-                    //formation flight is executed in tick
                 }
             }
Index: /code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- /code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc	(revision 10878)
+++ /code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc	(revision 10879)
@@ -71,4 +71,63 @@
             Action::FIGHTALL && this->myLeader_->getAction() != Action::ATTACK)
         {
+        }   
+        
+        SUPER(WingmanController, tick, dt);
+    }
+    
+    //----action for hard calculations----
+    void WingmanController::action()
+    {
+
+        //----If no leader, find one----
+        if (!this->myLeader_)
+        {
+            ActionpointController* newLeader = (findNewLeader());
+            this->myLeader_ = newLeader;
+            if (this->myLeader_)
+            {
+
+            }
+        }
+        //----If have leader, he will deal with logic----
+        else
+        {
+
+        }
+        if (!this->myLeader_)
+        {
+           ActionpointController::action();
+        }
+        else if (this->myLeader_)
+        {
+            switch (this->myLeader_->getAction())
+            {
+                case Action::FIGHT:
+                {
+                    if (!this->hasTarget())
+                    {
+                        this->setTarget(this->myLeader_->getTarget());
+                    }
+                    break;
+                }
+                case Action::FIGHTALL:
+                {
+                    if (!this->hasTarget())
+                    {
+                        this->setTarget(this->myLeader_->getTarget());
+                    }
+                    break;
+                }
+                case Action::ATTACK:
+                {
+                    if (!this->hasTarget())
+                    {
+                        this->setTarget(this->myLeader_->getTarget());
+                    }
+                    break;
+                }
+                default:
+                {
+                    
             ControllableEntity* myEntity = this->getControllableEntity();
             Vector3 myPosition = myEntity->getWorldPosition();
@@ -80,5 +139,4 @@
             Quaternion orient = leaderEntity->getWorldOrientation();
             Vector3 leaderPosition = leaderEntity->getWorldPosition();
-
             Vector3 targetRelativePosition = getFormationPosition();
             if (!this->myLeader_)
@@ -99,60 +157,4 @@
                this->getControllableEntity()->boost(false);
             }
-        }   
-        
-        SUPER(WingmanController, tick, dt);
-    }
-    
-    //----action for hard calculations----
-    void WingmanController::action()
-    {
-
-        //----If no leader, find one----
-        if (!this->myLeader_)
-        {
-            ActionpointController* newLeader = (findNewLeader());
-            this->myLeader_ = newLeader;
-           
-        }
-        //----If have leader, he will deal with logic----
-        else
-        {
-
-        }
-        if (!this->myLeader_)
-        {
-           ActionpointController::action();
-        }
-        else if (this->myLeader_)
-        {
-            switch (this->myLeader_->getAction())
-            {
-                case Action::FIGHT:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->setTarget(this->myLeader_->getTarget());
-                    }
-                    break;
-                }
-                case Action::FIGHTALL:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->setTarget(this->myLeader_->getTarget());
-                    }
-                    break;
-                }
-                case Action::ATTACK:
-                {
-                    if (!this->hasTarget())
-                    {
-                        this->setTarget(this->myLeader_->getTarget());
-                    }
-                    break;
-                }
-                default:
-                {
-                    
                 }
             }
@@ -179,15 +181,15 @@
                 case FormationMode::WALL:
                 {
-                    targetRelativePosition = new Vector3 (2*this->spread_, 0, 0);  
+                    targetRelativePosition = new Vector3 (2*this->spread_, 0, 0 - this->tolerance_);  
                     break;
                 }
                 case FormationMode::FINGER4: 
                 {
-                    targetRelativePosition = new Vector3 (2*this->spread_, 0, this->spread_);  
+                    targetRelativePosition = new Vector3 (2*this->spread_, 0, this->spread_ - this->tolerance_);  
                     break;
                 }
                 case FormationMode::DIAMOND: 
                 {
-                    targetRelativePosition = new Vector3 (2*this->spread_, 0, this->spread_);                  
+                    targetRelativePosition = new Vector3 (2*this->spread_, 0, this->spread_ - this->tolerance_);                  
                     break;
                 }
@@ -200,15 +202,15 @@
                 case FormationMode::WALL:
                 {
-                    targetRelativePosition = new Vector3 (-2*this->spread_, 0, 0);  
+                    targetRelativePosition = new Vector3 (-2*this->spread_, 0, 0 - this->tolerance_);  
                     break;
                 }
                 case FormationMode::FINGER4: 
                 {
-                    targetRelativePosition = new Vector3 (-2*this->spread_, 0, this->spread_);  
+                    targetRelativePosition = new Vector3 (-2*this->spread_, 0, this->spread_ - this->tolerance_);  
                     break;
                 }
                 case FormationMode::DIAMOND: 
                 {
-                    targetRelativePosition = new Vector3 (2*this->spread_, -this->spread_, 0);                  
+                    targetRelativePosition = new Vector3 (2*this->spread_, -this->spread_, 0 - this->tolerance_);                  
                     break;
                 }
