Index: code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.cc	(revision 9231)
+++ code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.cc	(revision 9232)
@@ -36,4 +36,5 @@
 #include <OgreTextAreaOverlayElement.h>
 #include <OgrePanelOverlayElement.h>
+#include <OgreEntity.h>
 
 #include "util/Math.h"
@@ -45,4 +46,6 @@
 #include "Radar.h"
 #include "graphics/Camera.h"
+#include "graphics/Model.h"
+#include "worldentities/MovableEntity.h"
 #include "controllers/HumanController.h"
 #include "worldentities/pawns/Pawn.h"
@@ -80,4 +83,24 @@
     this->setNavMarkerSize ( 0.05f );
     this->setDetectionLimit( 10000.0f ); 
+
+    //Ogre::Entity* ent = this->getScene()->getSceneManager()->createEntity("Arrow3D", "Arrow3D.mesh");
+
+    Model* arrow = new Model(this);
+    this->arrowEntity = new MovableEntity(this);
+    arrow->setMeshSource("Arrow3D.mesh");
+    arrow->setSyncMode(0);
+    this->arrowEntity->attach(arrow);
+    this->arrowEntity->scale(1);
+    this->arrowEntity->setVisible(true);
+    this->arrowEntity->setPosition(0, +30, -100);
+    this->arrowEntity->setSyncMode(0);
+    this->arrowEntity->attachToNode(this->overlay3d_);
+    //this->add3DMesh(arrowEntity);
+
+    //this->overlay3d_->setPosition(0, 0, 0);
+    //this->overlay3d_->setVisible(false, true);
+    this->overlay_->setZOrder(0);
+    this->overlay_->show();
+    hideArrow3D();
 }
 
@@ -178,4 +201,21 @@
     unsigned int markerCount_ = 0;
     bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player
+
+    //for the first element of sortedObjectList_ / the closest waypoint show the Arrow3D
+    //set the direction of the arrow to the closest waypoint
+    if(!sortedObjectList_.empty())
+    {
+    	showArrow3D();
+		sortedList::iterator firstIt = sortedObjectList_.begin();
+
+		Ogre::Vector3 pos1 = camTransform * firstIt->first->getRVWorldPosition();
+		orxout(user_info, context::events()) << pos1 << endl;
+		this->arrowEntity->setDirection(1-pos1.x, 1 - pos1.y, 1 - pos1.z);
+
+		//this->arrowEntity->rotate(quat);
+		//this->overlay3d_->setDirection(pos1);
+    }
+    else{hideArrow3D();}
+
 
 //         for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it)
@@ -382,5 +422,10 @@
     this->background_->addChild ( text );
 
-    sortedObjectList_.push_front ( std::make_pair ( object, ( unsigned int ) 0 ) );
+    Ogre::Vector3 temp = object->getWorldEntity()->getPosition();
+    unsigned int distance = sqrt(temp.x*temp.x+temp.y*temp.y+temp.z*temp.z);
+
+
+
+    sortedObjectList_.push_front ( std::make_pair ( object, distance ) );
 
 
@@ -445,4 +490,9 @@
     }
 }
-
-}
+void HUDNavigation::showArrow3D()
+		{ this->overlay3d_->setVisible(true, true);}
+void HUDNavigation::hideArrow3D()
+		{ this->overlay3d_->setVisible(false, true);}
+
+
+}
Index: code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.h
===================================================================
--- code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.h	(revision 9231)
+++ code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.h	(revision 9232)
@@ -42,4 +42,5 @@
 #include "overlays/OrxonoxOverlay.h"
 
+
 namespace orxonox
 {
@@ -51,4 +52,6 @@
 
     void setConfigValues();
+
+
 
     virtual void XMLPort ( Element& xmlelement, XMLPort::Mode mode );
@@ -80,4 +83,9 @@
 
     };
+
+    void showArrow3D();
+    void hideArrow3D();
+
+    orxonox::MovableEntity* arrowEntity;
 
     bool showObject( RadarViewable* rv );
Index: code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.cc
===================================================================
--- code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.cc	(revision 9232)
+++ code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.cc	(revision 9232)
@@ -0,0 +1,187 @@
+/*
+ *   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:
+ *      Nino Weingart
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file FlagPickup.cc
+    @brief Implementation of the FlagPickup class.
+*/
+
+#include "FlagPickup.h"
+
+#include <sstream>
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "pickup/PickupIdentifier.h"
+
+namespace orxonox
+{
+
+    CreateFactory(FlagPickup);
+
+    /**
+    @brief
+        Constructor. Registers the object and initializes the member variables.
+    */
+    FlagPickup::FlagPickup(BaseObject* creator) : Pickup(creator)
+    {
+        RegisterObject(FlagPickup);
+
+        this->initialize();
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    FlagPickup::~FlagPickup()
+    {
+
+    }
+
+    /**
+    @brief
+        Initializes the member variables.
+    */
+    void FlagPickup::initialize(void)
+    {
+        this->flagType_ = 0;
+
+        this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
+    }
+
+    /**
+    @brief
+        Initializes the PickupIdentifier of this pickup.
+    */
+    void FlagPickup::initializeIdentifier(void)
+    {
+    	std::stringstream stream;
+        int type = this->getFlagType();
+        stream << type;
+		std::string val = stream.str();
+		
+        std::string type1 = "flagType";
+        this->pickupIdentifier_->addParameter(type1, val);
+    }
+
+    /**
+    @brief
+        Method for creating a FlagPickup object through XML.
+    */
+    void FlagPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
+    {
+        SUPER(FlagPickup, XMLPort, xmlelement, mode);
+
+        XMLPortParam(FlagPickup, "flagType", setFlagType, getFlagType, xmlelement, mode);
+        //XMLPortParam(FlagPickup, "teamNumber", setTeamNumber, getTeamNumber, xmlelement, mode);
+
+        this->initializeIdentifier();
+    }
+
+
+    /**
+    @brief
+        Get the flag type of this pickup.
+    @return
+        Returns the falg type as a string.
+    */
+    const int FlagPickup::getFlagType(void) const
+    {
+		return this->flagType_;
+	}
+
+    /**
+    @brief
+        Set the type of the HealthPickup.
+    @param type
+        The type as a string.
+    */
+    void FlagPickup::setFlagType(int type)
+    {
+        if(type<3){
+        	this->flagType_ = type;
+        }
+        
+        else{
+            orxout(internal_error, context::pickups) << "Invalid flagType '" << type << "' in FlagPickup." << endl;
+    	}
+    }
+
+    /**
+       @brief
+           Is called when the pickup has transited from used to unused or the other way around.
+       */
+       void FlagPickup::changedUsed(void)
+       {
+           SUPER(FlagPickup, changedUsed);
+
+           Pawn* pawn = this->carrierToPawnHelper();
+
+           if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
+               this->Pickupable::destroy();
+
+           // If the pickup has transited to used.
+           if(this->isUsed())
+           {
+           	 this->bPickedUp_ = true;
+           	 this->pickedUpBy_ = pawn;
+           }
+       }
+
+       /**
+       @brief
+           Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
+       @return
+           A pointer to the Pawn, or NULL if the conversion failed.
+       */
+       Pawn* FlagPickup::carrierToPawnHelper(void)
+       {
+           PickupCarrier* carrier = this->getCarrier();
+           Pawn* pawn = dynamic_cast<Pawn*>(carrier);
+
+           if(pawn == NULL)
+               orxout(internal_error, context::pickups) << "Invalid PickupCarrier in HealthPickup." << endl;
+
+           return pawn;
+       }
+
+
+
+	void FlagPickup::tick(float dt)
+	   {
+		   SUPER(FlagPickup, tick, dt);
+
+	       Pawn* pawn = this->carrierToPawnHelper();
+
+		   if(pawn->isAlive() && pawn->hasFlag()){
+               this->Pickupable::destroy();
+		   }
+
+	   }
+}
Index: code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.h
===================================================================
--- code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.h	(revision 9232)
+++ code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.h	(revision 9232)
@@ -0,0 +1,106 @@
+/*
+ *   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:
+ *      Nino Weingart
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file FlagPickup.h
+    @brief Declaration of the FlagPickup class.
+    @ingroup PickupItems
+*/
+
+#ifndef _FlagPickup_H__
+#define _FlagPickup_H__
+
+#include "pickup/PickupPrereqs.h"
+#include "worldentities/pawns/Pawn.h"
+
+#include <string>
+
+#include "pickup/Pickup.h"
+#include "tools/Timer.h"
+#include "tools/interfaces/Tickable.h"
+
+
+namespace orxonox {
+/*
+    @ingroup PickupItems
+    
+
+    @author
+        Nino Weingart
+
+    @ingroup PickupItems
+    */
+    class _PickupExport FlagPickup : public Pickup, public Tickable
+    {
+        public:
+
+            FlagPickup(BaseObject* creator); //!< Constructor.
+            virtual ~FlagPickup(); //!< Destructor.
+
+            virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a FlagPickup object through XML.
+
+            virtual void tick(float dt);
+
+	    const int getFlagType(void) const; //!< Get the flag type of this pickup.
+	    
+		inline bool isPickedUp() const
+			{ return this->bPickedUp_; }
+		inline Pawn* pickedUpBy() const
+			{ return this->pickedUpBy_; }
+			
+		inline void setPickedUp(bool pickedUp)
+		{ this->bPickedUp_ = pickedUp; }
+		
+		inline void ignorePickedUp()
+		{ this->Pickupable::destroy(); }
+			
+	    virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
+
+        protected:
+            void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
+
+            /**
+            @brief Set the flag type of this pickup.
+            @param type The type of this pickup as an enum.
+            */
+            inline void setFlagTypeDirect(int type)
+                { this->flagType_ = type; }
+            void setFlagType(int type); //!< Set the type of the FlagPickup.
+
+        private:
+            Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
+            void initialize(void); //!< Initializes the member variables.
+            Pawn* pickedUpBy_;
+			int flagType_;
+			
+			bool bPickedUp_;
+			
+    };
+}
+
+#endif // _FlagPickup_H__
