Index: /code/branches/Presentation_HS17/src/orxonox/controllers/ArrowController.cc
===================================================================
--- /code/branches/Presentation_HS17/src/orxonox/controllers/ArrowController.cc	(revision 11688)
+++ /code/branches/Presentation_HS17/src/orxonox/controllers/ArrowController.cc	(revision 11688)
@@ -0,0 +1,156 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oli Scheuss
+ *   Co-authors:
+ *      Damian 'Mozork' Frick
+ *
+ */
+
+#include "ArrowController.h"
+#include "HumanController.h"
+#include "worldentities/WorldEntity.h"
+    
+#include "worldentities/Arrow.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+
+    RegisterClass(ArrowController);
+
+
+
+    /**
+    @brief
+        Constructor.
+    */
+    ArrowController::ArrowController(Context* context) : Controller(context)
+    {
+
+        RegisterObject(ArrowController);
+
+        this->currentGPSPoint_ = 0;
+        this->accuracy_ = 1000.0f;
+
+        arrow = nullptr;
+
+        for(Arrow* a: ObjectList<Arrow>())
+            arrow = a;
+
+        assert(arrow != nullptr);
+        this->setControllableEntity(arrow);
+
+        orxout() << "constructor aufgerufen" << endl;
+    }
+    
+    //Set the distance you need to reach before the next waypoint will be selected
+    void ArrowController::setAccuracy(float accuracy){
+      this->accuracy_ = accuracy;
+    }
+
+    float ArrowController::getAccuracy(){
+      return this->accuracy_;
+    };
+    
+    void ArrowController::addGPSPoint(WorldEntity* gpspoint)
+    {
+        this->gpspoints_.push_back(gpspoint);
+    }
+
+    WorldEntity* ArrowController::getGPSPoint(unsigned int index) const
+    {
+        if (index < this->gpspoints_.size())
+            return this->gpspoints_[index];
+        else
+            return nullptr;
+    }
+    /**
+    @brief
+        Destructor.
+    */
+
+    ArrowController::~ArrowController()
+    {
+      for (WorldEntity* gpspoint : this->gpspoints_)
+        {
+            if(gpspoint)
+                gpspoint->destroy();
+        } 
+
+    }
+
+
+    void ArrowController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ArrowController, XMLPort, xmlelement, mode);
+
+        XMLPortObject(ArrowController, WorldEntity, "gpspoints", addGPSPoint, getGPSPoint,  xmlelement, mode);
+        XMLPortParam(ArrowController, "accuracy", setAccuracy, getAccuracy, xmlelement, mode);
+    }
+
+    void ArrowController::tick(float dt)
+    {
+        if (!this->isActive())
+            return;
+
+        if (this->gpspoints_.size() == 0 || !this->getControllableEntity())
+            return;
+        //Set all waypoint to invisible at the beginning  
+        if (this->currentGPSPoint_ == 0){
+          for(unsigned int i = 0; i < this->gpspoints_.size(); i++ )
+            this->gpspoints_[i]->setVisible(false);
+        }
+        //Make the arrow inivisible as soon as you reached the last Waypoint, otherwise make the next waypoint visible 
+        if(currentGPSPoint_ >= gpspoints_.size()){
+          this->getControllableEntity()->setVisible(false);
+          return;
+        }
+        else this->gpspoints_[this->currentGPSPoint_]->setVisible(true);
+
+        //Set the next waypoint as target as soon as you reached the previous one
+        if (this->gpspoints_[this->currentGPSPoint_]->getWorldPosition().squaredDistance(this->getControllableEntity()->getPosition()) <= this->accuracy_){
+            this->gpspoints_[this->currentGPSPoint_]->setVisible(false);
+            this->currentGPSPoint_ = (this->currentGPSPoint_ + 1);
+            return;
+          }
+  
+        Vector3 target = gpspoints_[currentGPSPoint_]->getWorldPosition();
+        WorldEntity::TransformSpace trans = WorldEntity::TransformSpace::World;
+
+        //Get the position and orientation of the Spaceship
+        Vector3 spaceShipPosition = HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition();
+        Quaternion spaceShipOrientation = HumanController::getLocalControllerSingleton()->getControllableEntity()->getOrientation();
+        
+        //Calculate the new arrow position
+        Vector3 ss_y = spaceShipOrientation.yAxis();
+        spaceShipPosition.x += 20 * ss_y.x;
+        spaceShipPosition.y += 20 * ss_y.y;
+        spaceShipPosition.z += 20 * ss_y.z;
+        
+        //Update Arrow position and orientation  
+        this->getControllableEntity()->setPosition(spaceShipPosition);
+        this->getControllableEntity()->lookAt(target, trans, Vector3(0,0,1));
+        
+        
+    }
+}
Index: /code/branches/Presentation_HS17/src/orxonox/controllers/ArrowController.h
===================================================================
--- /code/branches/Presentation_HS17/src/orxonox/controllers/ArrowController.h	(revision 11688)
+++ /code/branches/Presentation_HS17/src/orxonox/controllers/ArrowController.h	(revision 11688)
@@ -0,0 +1,73 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oli Scheuss
+ *   Co-authors:
+ *      Damian 'Mozork' Frick
+ *
+ */
+
+#ifndef _ArrowController_H__
+#define _ArrowController_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Controller.h"
+#include "tools/interfaces/Tickable.h"
+#include "worldentities/Arrow.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Controller for the Arrow of the PPS tutorial.
+    @author
+        Oli Scheuss
+    */
+    class _OrxonoxExport ArrowController : public Controller, public Tickable
+    {
+        public:
+            ArrowController(Context* context);
+            virtual ~ArrowController();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+            
+            void addGPSPoint(WorldEntity* gpspoint);
+            WorldEntity* getGPSPoint(unsigned int index) const;
+            void setAccuracy(float accuracy);
+            float getAccuracy();
+
+            virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick.
+
+        protected:
+
+            std::vector<WeakPtr<WorldEntity>> gpspoints_;
+            size_t currentGPSPoint_;
+            float accuracy_;
+            WorldEntity* defaultGPSpoint_;
+
+        private:
+            Arrow *arrow;
+    };
+}
+
+#endif /* _ArrowController_H__ */
