Index: code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	(revision 10781)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.cc	(revision 10782)
@@ -251,20 +251,100 @@
         }
     }
-
-    bool CommonController::isCloseAtTarget(float distance) const
+    //to be called in action
+    //PRE: relativeTargetPosition is desired position relative to the spaceship,
+    //angleRoll is the angle of Roll that should be applied by the end of the movement
+    //POST: targetPosition_ and angleRoll_ are set, so that it can be used by MoveAndRoll()
+    void MoveToPoint(const Vector3& relativeTargetPosition, float angleRoll)
+    {
+        ControllableEntity* entity = this->getControllableEntity();
+        if (!entity)
+            return false;
+        Quaternion orient = entity->getWorldOrientation();
+
+        Vector3 target = orient * relativeTargetPosition + entity->getWorldPosition();
+        setTargetPosition(target);
+        this->angleRoll_ = angleRoll;
+        this->angleRolled_ = 0;
+    }
+    //to be called in tick
+    //PRE: MoveToPoint was called
+    //POST: spaceship changes its yaw and pitch to point towards targetPosition_,
+    //moves towards targetPosition_ by amount depending on dt and its speed,
+    //rolls by amount depending on the difference between angleRoll_ and angleRolled_, dt, and 
+    //angular speed
+    //if position reached with a certain tolerance, and angleRolled_ = angleRoll_, returns false,
+    //otherwise returns true
+    bool MoveAndRoll(float dt)
+    {
+        int tolerance = 60;
+        float rollDiff = angleRoll-angleRolled_;
+        float angleToRoll = 0;
+        ControllableEntity* entity = this->getControllableEntity();
+        if (!entity)
+            return false;
+        Vector2 coord = get2DViewCoordinates
+            (entity->getPosition(), 
+            entity->getOrientation() * WorldEntity::FRONT, 
+            entity->getOrientation() * WorldEntity::UP, 
+            targetPosition_);
+
+        float distance = (targetPosition_ - this->getControllableEntity()->getPosition()).length();
+
+        //rotates should be in range [-1,+1], clamp cuts off all that is not
+        float rotateX = clamp(coord.x * 10, -1.0f, 1.0f);
+        float rotateY = clamp(coord.y * 10, -1.0f, 1.0f);
+
+        
+        if (distance > tolerance)
+        {
+            //Yaw and Pitch are enough to start facing the target
+            this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR * rotateX * dt);
+            this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR * rotateY * dt);
+            
+            //Move
+            this->getControllableEntity()->moveFrontBack(1.2f * SPEED * factor * dt);
+            
+            //Roll
+            angleToRoll = rollDiff * ROTATEFACTOR * dt;
+            this->getControllableEntity()->rotateRoll(angleToRoll);
+            angleRolled_ += angleToRoll;
+            //if still moving, return false
+            return false;
+        }
+        else
+        {     
+            if (rollDiff > 0)
+            {
+                //Roll
+                angleToRoll = rollDiff * ROTATEFACTOR * dt;
+                this->getControllableEntity()->rotateRoll(angleToRoll);
+                angleRolled_ += angleToRoll;                
+
+                //Move
+                this->getControllableEntity()->moveFrontBack(0.6f * SPEED * factor);
+                return false;
+            }
+            //if finished, return true;
+            retun true;
+        }
+    }
+
+    float squaredDistanceToTarget()
+    {
+        if ( !this->getControllableEntity() )
+            return 0;
+        if ( !this->target_ )
+            return ( this->getControllableEntity()->
+                getPosition().squaredDistance(this->targetPosition_) );
+        else
+            return ( this->getControllableEntity()->
+                getPosition().squaredDistance(this->target_->getPosition()) );
+    }
+    
+    bool CommonController::isLookingAtTarget(float angle) const
     {
         if (!this->getControllableEntity())
             return false;
 
-        if (!this->target_)
-            return (this->getControllableEntity()->getPosition().squaredDistance(this->targetPosition_) < distance*distance);
-        else
-            return (this->getControllableEntity()->getPosition().squaredDistance(this->target_->getPosition()) < distance*distance);
-    }
-    bool CommonController::isLookingAtTarget(float angle) const
-    {
-        if (!this->getControllableEntity())
-            return false;
-
         return (getAngle(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->targetPosition_) < angle);
     }
@@ -272,5 +352,6 @@
     bool CommonController::canFire()
     {
-        if ( this->bShooting_ && this->isCloseAtTarget(3000) && this->isLookingAtTarget(math::pi / 20.0f) )
+        float squaredDistance = squaredDistanceToTarget();
+        if ( this->bShooting_ && squaredDistance < 9000000 && squaredDistance > 10000 && this->isLookingAtTarget(math::pi /(0.0002f*squaredDistance)) )
         {
             return true;
Index: code/branches/AI_HS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	(revision 10781)
+++ code/branches/AI_HS15/src/orxonox/controllers/CommonController.h	(revision 10782)
@@ -129,5 +129,5 @@
             void copyTargetOrientation();
 
-            bool isCloseAtTarget(float distance) const;
+            float squaredDistanceToTarget() const;
             void doFire();
             void aimAtTarget();
@@ -150,8 +150,9 @@
 
 
-            bool bHasObjectivePosition_;
-            Vector3 objectivePosition_;
-            bool bHasObjectiveOrientation_;
-            Quaternion objectiveOrientation_;
+            bool bHasPositionOfTarget_;
+            Vector3 positionOfTarget_;
+            bool bHasOrientationOfTarget_;
+            Quaternion orientationOfTarget_;
+
 
             WeakPtr<ControllableEntity> target_;
@@ -159,4 +160,6 @@
             WeakPtr<ControllableEntity> objectiveTarget_;
 
+            float angleRolled_;
+            float angleRoll_;
 
 
