Index: code/trunk/src/orxonox/GraphicsEngine.cc
===================================================================
--- code/trunk/src/orxonox/GraphicsEngine.cc	(revision 1563)
+++ code/trunk/src/orxonox/GraphicsEngine.cc	(revision 1564)
@@ -53,4 +53,5 @@
 
 #include "console/InGameConsole.h"
+#include "hud/HUD.h"
 #include "tools/ParticleInterface.h"
 #include "Settings.h"
@@ -455,4 +456,5 @@
     InputManager::setWindowExtents(w, h);
     InGameConsole::getInstance().resize();
+    HUD::getSingleton().resize();
   }
 
Index: code/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 1563)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 1564)
@@ -114,8 +114,10 @@
   // hud
   class BarOverlayElement;
+  class BarOverlayElementFactory;
   class HUD;
   class Navigation;
   class RadarObject;
   class RadarOverlayElement;
+  class RadarOverlayElementFactory;
 
   //console
Index: code/trunk/src/orxonox/hud/BarOverlayElement.cc
===================================================================
--- code/trunk/src/orxonox/hud/BarOverlayElement.cc	(revision 1563)
+++ code/trunk/src/orxonox/hud/BarOverlayElement.cc	(revision 1564)
@@ -31,4 +31,5 @@
 #include <OgreOverlayManager.h>
 #include "GraphicsEngine.h"
+#include "util/Math.h"
 
 namespace orxonox
@@ -36,18 +37,21 @@
     using namespace Ogre;
 
-    BarOverlayElement::BarOverlayElement(const String& name):PanelOverlayElement(name){
+    BarOverlayElement::BarOverlayElement(const String& name) : PanelOverlayElement(name)
+    {
         name_ = name;
+        widthratio_ = 100.0f / 800.0f; // calculates the ratio (backgroundwidth - barwidth) / backgroundwidth
     }
 
-    BarOverlayElement::~BarOverlayElement(){}
+    BarOverlayElement::~BarOverlayElement()
+    {
+        OverlayManager::getSingleton().destroyOverlayElement(this->background_);
+    }
 
     void BarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, OverlayContainer* container){
         // init some values...
-        container_ = container;
-        om = &OverlayManager::getSingleton();
         value_ = 0;
-        color_ = 2;
-        autoColor_ = true;
-        left2Right = false; 	// default is right to left progress
+        colour_ = 2;
+        autoColour_ = true;
+        right2Left_ = false; // default is left to right progress
         leftRel_ = leftRel;
         topRel_ = topRel;
@@ -55,7 +59,7 @@
 
         // create background...
-        background_ = static_cast<OverlayContainer*>(om->createOverlayElement("Panel", name_+"container"));
+        background_ = static_cast<OverlayContainer*>(OverlayManager::getSingleton().createOverlayElement("Panel", name_+"container"));
         background_->show();
-        container_->addChild(background_);
+        container->addChild(background_);
         background_->setMetricsMode(GMM_PIXELS);
         background_->setMaterialName("Orxonox/BarBackground");
@@ -71,11 +75,12 @@
 
     void BarOverlayElement::resize(){
-        windowW_ = GraphicsEngine::getSingleton().getWindowWidth();
-        windowH_ = GraphicsEngine::getSingleton().getWindowHeight();
         // calculate new absolute coordinates...
-        left_ = (int) (leftRel_ * windowW_);
-        top_ = (int) (topRel_ * windowH_);
-        width_ = (int) (dimRel_ * windowW_);
-        height_ = (int) (0.1*width_);	// the texture has dimensions height:length = 1:10
+        left_ = (int) (leftRel_ * GraphicsEngine::getSingleton().getWindowWidth());
+        top_ = (int) (topRel_ * GraphicsEngine::getSingleton().getWindowHeight());
+        width_ = (int) (dimRel_ * GraphicsEngine::getSingleton().getWindowWidth());
+        height_ = (int) (0.1 * width_);	// the texture has dimensions height:length = 1:10
+        offset_ = (int) (width_ * widthratio_ * 0.5);
+        barwidth_ = (int) (width_ * (1.0f - widthratio_));
+
         // adapt background
         background_->setPosition(left_, top_);
@@ -86,25 +91,26 @@
 
     void BarOverlayElement::setValue(float value){
-        value_ = value;
-        // set color, if nescessary
-        if(autoColor_){
-            if (value_>0.5) {setColor(BarOverlayElement::GREEN);}
-            else if (value_>0.25) {setColor(BarOverlayElement::YELLOW);}
-            else setColor(BarOverlayElement::RED);
+        value_ = clamp<float>(value, 0, 1);
+        // set colour, if nescessary
+        if(autoColour_){
+            if (value_>0.5) {setColour(BarOverlayElement::GREEN);}
+            else if (value_>0.25) {setColour(BarOverlayElement::YELLOW);}
+            else setColour(BarOverlayElement::RED);
         }
+
         // set value
-        if(left2Right){ // backward case
-            setPosition(0+width_-width_*value_, 0);
-            setDimensions(width_*value_,height_);
+        if(right2Left_){ // backward case
+            setPosition(offset_ + barwidth_ * (1 - value_), 0);
+            setDimensions(barwidth_ * value_, height_);
         }else{          // default case
-            setPosition(0, 0);
-            setDimensions(width_*value_,height_);
+            setPosition(offset_, 0);
+            setDimensions(barwidth_ * value_, height_);
         }
         if(value_ != 0) setTiling(value_, 1.0);
     }
 
-    void BarOverlayElement::setColor(int color){
-        color_ = color;
-        switch(color){
+    void BarOverlayElement::setColour(int colour){
+        colour_ = colour;
+        switch(colour){
         case 0:
             setMaterialName("Orxonox/Red");
@@ -117,11 +123,3 @@
         }
     }
-
-    float BarOverlayElement::getValue(){
-        return(value_);
-    }
-
-    int BarOverlayElement::getBarColor(){
-        return(color_);
-    }
 }
Index: code/trunk/src/orxonox/hud/BarOverlayElement.h
===================================================================
--- code/trunk/src/orxonox/hud/BarOverlayElement.h	(revision 1563)
+++ code/trunk/src/orxonox/hud/BarOverlayElement.h	(revision 1564)
@@ -39,35 +39,43 @@
   class _OrxonoxExport BarOverlayElement : public Ogre::PanelOverlayElement
   {
+    public:
+      BarOverlayElement(const Ogre::String& name);
+      virtual ~BarOverlayElement();
+
+      void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container);
+      void resize();
+      void setValue(float value);
+      void setColour(int colour);
+
+      inline void setRightToLeft(bool r2l)
+        { this->right2Left_ = r2l; }
+      inline bool getRightToLeft() const
+        { return this->right2Left_; }
+      inline float getValue() const
+        { return this->value_; }
+      inline int getBarColour() const
+        { return this->colour_; }
+
     private:
-      bool autoColor_;                    // whether bar changes color automatically
+      static const int RED = 0;           // predefined colours
+      static const int YELLOW = 1;
+      static const int GREEN = 2;
+
+      bool right2Left_;
+      bool autoColour_;                   // whether bar changes colour automatically
       float value_;                       // progress of bar
-      int color_;
+      int colour_;
       int left_;
       int top_;
       int width_;
       int height_;
-      int windowW_, windowH_;
+      float widthratio_;
+      int offset_;
+      int barwidth_;
       Ogre::Real leftRel_;
       Ogre::Real topRel_;
       Ogre::Real dimRel_;
-      Ogre::OverlayManager* om;           // our overlay manager
-      Ogre::OverlayContainer* container_; // our parent container to attach to
       Ogre::OverlayContainer* background_;
       Ogre::String name_;
-
-    public:
-      bool left2Right;
-      static const int RED = 0;           // predefined colors
-      static const int YELLOW = 1;
-      static const int GREEN = 2;
-
-      BarOverlayElement(const Ogre::String& name);
-      virtual ~BarOverlayElement();
-      void init(Real leftRel, Real topRel, Real dimRel, Ogre::OverlayContainer* container);
-      void resize();
-      void setValue(float value);
-      void setColor(int color);
-      float getValue();
-      int getBarColor();
     };
 }
Index: code/trunk/src/orxonox/hud/HUD.cc
===================================================================
--- code/trunk/src/orxonox/hud/HUD.cc	(revision 1563)
+++ code/trunk/src/orxonox/hud/HUD.cc	(revision 1564)
@@ -40,4 +40,5 @@
 #include "core/ConsoleCommand.h"
 #include "objects/SpaceShip.h"
+#include "objects/WorldEntity.h"
 #include "GraphicsEngine.h"
 #include "BarOverlayElement.h"
@@ -50,4 +51,5 @@
 {
     SetConsoleCommandShortcut(HUD, cycleNavigationFocus).setAccessLevel(AccessLevel::User);
+    SetConsoleCommandShortcut(HUD, releaseNavigationFocus).setAccessLevel(AccessLevel::User);
     SetConsoleCommandShortcut(HUD, toggleFPS).setAccessLevel(AccessLevel::User);
     SetConsoleCommandShortcut(HUD, toggleRenderTime).setAccessLevel(AccessLevel::User);
@@ -55,112 +57,129 @@
     using namespace Ogre;
 
-    HUD::HUD(){
-        om = &Ogre::OverlayManager::getSingleton();
-        sm = GraphicsEngine::getSingleton().getSceneManager();
-        showFPS = true;
-        showRenderTime = true;
+    HUD::HUD()
+    {
+        showFPS_ = true;
+        showRenderTime_ = true;
 
         // create Factories
-        BarOverlayElementFactory *barOverlayElementFactory = new BarOverlayElementFactory();
-        om->addOverlayElementFactory(barOverlayElementFactory);
-        RadarOverlayElementFactory *radarOverlayElementFactory = new RadarOverlayElementFactory();
-        om->addOverlayElementFactory(radarOverlayElementFactory);
-
-        orxonoxHUD = om->create("Orxonox/HUD");
-        container = static_cast<Ogre::OverlayContainer*>(om->createOverlayElement("Panel", "Orxonox/HUD/container"));
+        barOverlayElementFactory_ = new BarOverlayElementFactory();
+        Ogre::OverlayManager::getSingleton().addOverlayElementFactory(barOverlayElementFactory_);
+        radarOverlayElementFactory_ = new RadarOverlayElementFactory();
+        Ogre::OverlayManager::getSingleton().addOverlayElementFactory(radarOverlayElementFactory_);
+
+        orxonoxHUD_ = Ogre::OverlayManager::getSingleton().create("Orxonox/HUD");
+        container_ = static_cast<Ogre::OverlayContainer*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Orxonox/HUD/container"));
 
         // creating text to display fps
-        fpsText = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "fpsText"));
-        fpsText->show();
-        fpsText->setMetricsMode(Ogre::GMM_PIXELS);
-        fpsText->setDimensions(0.001, 0.001);
-        fpsText->setPosition(10, 10);
-        fpsText->setFontName("Console");
-        fpsText->setCharHeight(20);
-        fpsText->setCaption("init");
+        fpsText_ = static_cast<TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("TextArea", "fpsText"));
+        fpsText_->show();
+        fpsText_->setMetricsMode(Ogre::GMM_PIXELS);
+        fpsText_->setDimensions(0.001, 0.001);
+        fpsText_->setPosition(10, 10);
+        fpsText_->setFontName("Console");
+        fpsText_->setCharHeight(20);
+        fpsText_->setCaption("init");
 
         // creating text to display render time ratio
-        rTRText = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "rTRText"));
-        rTRText->show();
-        rTRText->setMetricsMode(Ogre::GMM_PIXELS);
-        rTRText->setDimensions(0.001, 0.001);
-        rTRText->setPosition(10, 30);
-        rTRText->setFontName("Console");
-        rTRText->setCharHeight(20);
-        rTRText->setCaption("init");
+        rTRText_ = static_cast<TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("TextArea", "rTRText"));
+        rTRText_->show();
+        rTRText_->setMetricsMode(Ogre::GMM_PIXELS);
+        rTRText_->setDimensions(0.001, 0.001);
+        rTRText_->setPosition(10, 30);
+        rTRText_->setFontName("Console");
+        rTRText_->setCharHeight(20);
+        rTRText_->setCaption("init");
 
         // create energy bar
-        energyBar = static_cast<BarOverlayElement*>(om->createOverlayElement("Bar", "energyBar"));
-        energyBar->show();
+        energyBar_ = static_cast<BarOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Bar", "energyBar"));
+        energyBar_->show();
         // create speedo bar
-        speedoBar = static_cast<BarOverlayElement*>(om->createOverlayElement("Bar", "speedoBar"));
-        speedoBar->show();
+        speedoBar_ = static_cast<BarOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Bar", "speedoBar"));
+        speedoBar_->show();
         // create radar
-        radar = static_cast<RadarOverlayElement*>(om->createOverlayElement("Radar", "radar"));
-        radar->show();
+        radar_ = static_cast<RadarOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Radar", "radar"));
+        radar_->show();
 
         // create Navigation
-        nav = new Navigation(container);
+        nav_ = new Navigation(container_);
 
         // set up screen-wide container
-        container->show();
-
-        orxonoxHUD->add2D(container);
-        orxonoxHUD->show();
-        container->setLeft(0.0);
-        container->setTop(0.0);
-        container->setWidth(1.0);
-        container->setHeight(1.0);
-        container->setMetricsMode(Ogre::GMM_RELATIVE);
-        container->addChild(fpsText);
-        container->addChild(rTRText);
-
-        energyBar->init(0.01, 0.94, 0.4, container);
-        energyBar->setValue(1);
-
-        speedoBar->init(0.01, 0.90, 0.4, container);
-
-        radar->init(0.5, 0.9, 0.2, container);
-        SceneNode* node;
-        node = sm->getRootSceneNode()->createChildSceneNode("tomato1", Vector3(2000.0, 0.0, 0.0));
-        addRadarObject(node, ColourValue(0.5, 0, 0, 1));
-        node = sm->getRootSceneNode()->createChildSceneNode("tomato2", Vector3(0.0, 2000.0, 0.0));
-        addRadarObject(node, ColourValue(0.5, 0, 0, 1));
-        node = sm->getRootSceneNode()->createChildSceneNode("tomato3", Vector3(0.0, 0.0, 2000.0));
-        addRadarObject(node, ColourValue(0.5, 0, 0, 1));
-	node = sm->getRootSceneNode()->createChildSceneNode("station", Vector3(10000.0,16000.0,0.0));
-        addRadarObject(node);
-    }
-
-    HUD::~HUD(){
-        //todo: clean up objects
+        container_->show();
+
+        orxonoxHUD_->add2D(container_);
+        orxonoxHUD_->show();
+        container_->setLeft(0.0);
+        container_->setTop(0.0);
+        container_->setWidth(1.0);
+        container_->setHeight(1.0);
+        container_->setMetricsMode(Ogre::GMM_RELATIVE);
+        container_->addChild(fpsText_);
+        container_->addChild(rTRText_);
+
+        energyBar_->init(0.01, 0.94, 0.4, container_);
+        energyBar_->setValue(1);
+
+        speedoBar_->init(0.01, 0.90, 0.4, container_);
+
+        radar_->init(0.5, 0.9, 0.2, container_);
+
+        WorldEntity* object;
+        object = new WorldEntity();
+        object->setPosition(2000.0, 0.0, 0.0);
+        addRadarObject(object, ColourValue(0.5, 0, 0, 1));
+        object = new WorldEntity();
+        object->setPosition(0.0, 2000.0, 0.0);
+        addRadarObject(object, ColourValue(0.5, 0, 0, 1));
+        object = new WorldEntity();
+        object->setPosition(0.0, 0.0, 2000.0);
+        addRadarObject(object, ColourValue(0.5, 0, 0, 1));
+        object = new WorldEntity();
+        object->setPosition(10000.0,16000.0,0.0);
+        addRadarObject(object);
+    }
+
+    HUD::~HUD()
+    {
+        Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->container_);
+        Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->fpsText_);
+        Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->rTRText_);
+        Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->energyBar_);
+        Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->speedoBar_);
+        Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->radar_);
+
+        delete this->nav_;
+        delete this->barOverlayElementFactory_;
+        delete this->radarOverlayElementFactory_;
     }
 
     void HUD::tick(float dt)
     {
-        energyBar->resize();
-
         if(!SpaceShip::getLocalShip())
           return;
+
         float v = SpaceShip::getLocalShip()->getVelocity().length();
         float vmax = SpaceShip::getLocalShip()->getMaxSpeed();
-        speedoBar->setValue(v/vmax);
-        speedoBar->resize();
-
-        radar->resize();
-        radar->update();
-
-        nav->update();
+        speedoBar_->setValue(v/vmax);
+
+        radar_->update();
+        nav_->update();
 
         setFPS();
     }
 
+    void HUD::resize()
+    {
+        this->speedoBar_->resize();
+        this->energyBar_->resize();
+        this->radar_->resize();
+    }
+
     void HUD::setRenderTimeRatio(float ratio)
     {
-        if(showRenderTime){
-            rTRText->setCaption("Render time ratio: " + Ogre::StringConverter::toString(ratio));
+        if(showRenderTime_){
+            rTRText_->setCaption("Render time ratio: " + Ogre::StringConverter::toString(ratio));
         }
         else{
-            rTRText->setCaption("");
+            rTRText_->setCaption("");
             return;
         }
@@ -168,40 +187,37 @@
 
     void HUD::setFPS(){
-        if(showFPS){
+        if(showFPS_){
             float fps = GraphicsEngine::getSingleton().getAverageFPS();
-            fpsText->setCaption("FPS: " + Ogre::StringConverter::toString(fps));
+            fpsText_->setCaption("FPS: " + Ogre::StringConverter::toString(fps));
         }
         else{
-            fpsText->setCaption("");
+            fpsText_->setCaption("");
             return;
         }
     }
 
-    void HUD::addRadarObject(SceneNode* node, const ColourValue& colour){
-        RadarObject* obj = new RadarObject(container, node, colour);
-        roSet.insert(obj);
+    void HUD::addRadarObject(WorldEntity* object, const ColourValue& colour){
+        RadarObject* obj = new RadarObject(container_, object, colour);
+        roSet_.insert(roSet_.end(), obj);
 //        // check if this is the first RadarObject to create
 //        if(firstRadarObject == NULL){
-//            firstRadarObject = new RadarObject(container, node, colour);
+//            firstRadarObject = new RadarObject(container_, object, colour);
 //            lastRadarObject = firstRadarObject;
 //        }
 //        else{ // if not, append to list
-//            lastRadarObject->next = new RadarObject(container, node, colour);
+//            lastRadarObject->next = new RadarObject(container_, object, colour);
 //            lastRadarObject = lastRadarObject->next;
 //        }
     }
 
-    void HUD::removeRadarObject(Ogre::SceneNode* node){
-        for(std::set<RadarObject*>::iterator it=roSet.begin(); it!=roSet.end(); ++it){
-            if ((*it)->getNode() == node)
+    void HUD::removeRadarObject(WorldEntity* object){
+        for(std::list<RadarObject*>::iterator it=roSet_.begin(); it!=roSet_.end(); ++it){
+            if ((*it)->getObject() == object)
             {
-                if (this->nav->focus_ == (*it))
-                {
-                    this->nav->cycleFocus();
-                    if (this->nav->focus_ == (*it))
-                        this->nav->focus_ = 0;
-                }
+                if (this->nav_->getFocus() == (*it))
+                    this->nav_->setFocus(0);
+
                 delete (*it);
-                roSet.erase(it);
+                roSet_.erase(it);
                 return;
             }
@@ -215,23 +231,21 @@
 
     /*static*/ void HUD::setEnergy(float value){
-        HUD::getSingleton().energyBar->setValue(value);
+        HUD::getSingleton().energyBar_->setValue(value);
     }
 
     /*static*/ void HUD::cycleNavigationFocus(){
-        HUD::getSingleton().nav->cycleFocus();
+        HUD::getSingleton().nav_->cycleFocus();
+    }
+
+    /*static*/ void HUD::releaseNavigationFocus(){
+        HUD::getSingleton().nav_->setFocus(0);
     }
 
     /*static*/ void HUD::toggleFPS(){
-        HUD::getSingleton().showFPS = !HUD::getSingleton().showFPS;
+        HUD::getSingleton().showFPS_ = !HUD::getSingleton().showFPS_;
     }
 
     /*static*/ void HUD::toggleRenderTime(){
-        HUD::getSingleton().showRenderTime = !HUD::getSingleton().showRenderTime;
+        HUD::getSingleton().showRenderTime_ = !HUD::getSingleton().showRenderTime_;
     }
 }
-
-
-
-
-
-
Index: code/trunk/src/orxonox/hud/HUD.h
===================================================================
--- code/trunk/src/orxonox/hud/HUD.h	(revision 1563)
+++ code/trunk/src/orxonox/hud/HUD.h	(revision 1564)
@@ -35,5 +35,4 @@
 #include <OgrePrerequisites.h>
 #include <OgreTextAreaOverlayElement.h>
-#include <OgreSceneNode.h>
 #include "objects/Tickable.h"
 #include "util/Math.h"
@@ -43,37 +42,44 @@
     class _OrxonoxExport HUD : public TickableReal
     {
-      private:
-        HUD();
-        HUD(HUD& instance);
-        ~HUD();
-        Ogre::OverlayManager* om;
-        Ogre::SceneManager* sm;
-        Ogre::Overlay* orxonoxHUD;
-        Ogre::OverlayContainer* container;
-        Ogre::TextAreaOverlayElement* fpsText;
-        Ogre::TextAreaOverlayElement* rTRText;
-        BarOverlayElement* energyBar;
-        BarOverlayElement* speedoBar;
-        RadarOverlayElement* radar;
-        Navigation* nav;
+      public:
+        static HUD& getSingleton();
+        virtual void tick(float);
 
-        bool showFPS;
-        bool showRenderTime;
-
-      public:
-        virtual void tick(float);
-        void addRadarObject(Ogre::SceneNode* node, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1));
-        void removeRadarObject(Ogre::SceneNode* node);
+        void resize();
+        void addRadarObject(WorldEntity* object, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1));
+        void removeRadarObject(WorldEntity* object);
         void setRenderTimeRatio(float ratio);
         void setFPS();
 
-        std::set<RadarObject*> roSet;
+        inline std::list<RadarObject*>& getRadarObjects()
+            { return this->roSet_; }
+
+        static void setEnergy(float value);
+        static void cycleNavigationFocus();
+        static void releaseNavigationFocus();
+        static void toggleFPS();
+        static void toggleRenderTime();
+
+      private:
+        HUD();
+        HUD(const HUD& instance);
+        ~HUD();
 
         static HUD* instance_s;
-        static HUD& getSingleton();
-        static void setEnergy(float value);
-        static void cycleNavigationFocus();
-        static void toggleFPS();
-        static void toggleRenderTime();
+
+        std::list<RadarObject*> roSet_;
+        Ogre::Overlay* orxonoxHUD_;
+        Ogre::OverlayContainer* container_;
+        BarOverlayElementFactory* barOverlayElementFactory_;
+        RadarOverlayElementFactory* radarOverlayElementFactory_;
+        Ogre::TextAreaOverlayElement* fpsText_;
+        Ogre::TextAreaOverlayElement* rTRText_;
+        BarOverlayElement* energyBar_;
+        BarOverlayElement* speedoBar_;
+        RadarOverlayElement* radar_;
+        Navigation* nav_;
+
+        bool showFPS_;
+        bool showRenderTime_;
     };
 }
Index: code/trunk/src/orxonox/hud/Navigation.cc
===================================================================
--- code/trunk/src/orxonox/hud/Navigation.cc	(revision 1563)
+++ code/trunk/src/orxonox/hud/Navigation.cc	(revision 1564)
@@ -41,4 +41,5 @@
 #include "HUD.h"
 #include "core/Debug.h"
+#include "util/Math.h"
 
 namespace orxonox
@@ -58,9 +59,14 @@
     }
 
+    Navigation::~Navigation()
+    {
+        OverlayManager::getSingleton().destroyOverlayElement(this->navText_);
+        OverlayManager::getSingleton().destroyOverlayElement(this->navMarker_);
+        OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_);
+    }
+
     void Navigation::init(){
-        om = &OverlayManager::getSingleton();
-        navCam_ = NULL;
         // create nav text
-        navText_ = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "navText"));
+        navText_ = static_cast<TextAreaOverlayElement*>(OverlayManager::getSingleton().createOverlayElement("TextArea", "navText"));
         navText_->show();
         navText_->setMetricsMode(Ogre::GMM_PIXELS);
@@ -70,48 +76,56 @@
         navText_->setCharHeight(20);
         navText_->setCaption("");
+        navText_->hide();
         container_->addChild(navText_);
 
 
         // create nav marker ...
-        navMarker_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel", "NavMarker"));
+        navMarker_ = static_cast<PanelOverlayElement*>(OverlayManager::getSingleton().createOverlayElement("Panel", "NavMarker"));
+        aimMarker_ = static_cast<PanelOverlayElement*>(OverlayManager::getSingleton().createOverlayElement("Panel", "aimMarker"));
         navMarker_->setMetricsMode(GMM_PIXELS);
+        aimMarker_->setMetricsMode(GMM_PIXELS);
         navMarker_->hide();
-        navText_->hide();
+        aimMarker_->hide();
         container_->addChild(navMarker_);
+        container_->addChild(aimMarker_);
     }
 
     void Navigation::update(){
-        if(focus_ == NULL) return;
-        navCamPos_ = SpaceShip::getLocalShip()->getPosition();
-        currentDir_ = SpaceShip::getLocalShip()->getDir();
-        currentOrth_ = SpaceShip::getLocalShip()->getOrth();
-
-        windowW_ = GraphicsEngine::getSingleton().getWindowWidth();
-        windowH_ = GraphicsEngine::getSingleton().getWindowHeight();
+        if (!focus_)
+            return;
+
         updateMarker();
     }
 
     void Navigation::updateMarker(){
+        int windowW = GraphicsEngine::getSingleton().getWindowWidth();
+        int windowH = GraphicsEngine::getSingleton().getWindowHeight();
+
         // set text
         int dist = (int) getDist2Focus()/100;
         navText_->setCaption(Ogre::StringConverter::toString(dist));
 
-        if(navCam_ == NULL) navCam_ = SpaceShip::getLocalShip()->getCamera()->cam_;
         Vector3 pos = focus_->getPosition();
+        Ogre::Camera* navCam = SpaceShip::getLocalShip()->getCamera()->cam_;
         // transform to screen coordinates
-        pos = navCam_->getProjectionMatrix()*navCam_->getViewMatrix()*pos;
+        pos = navCam->getProjectionMatrix() * navCam->getViewMatrix() * pos;
+
         float xPosRel = 0.5*pos.x+0.5;
         float yPosRel = 1-(0.5*pos.y+0.5);
-        int xPos = (int) (xPosRel*windowW_);
-        int yPos = (int) (yPosRel*windowH_);
-        int xFromCenter = xPos-windowW_/2;
-        int yFromCenter = yPos-windowH_/2;
+        int xPos = (int) (xPosRel*windowW);
+        int yPos = (int) (yPosRel*windowH);
+        int xFromCenter = xPos-windowW/2;
+        int yFromCenter = yPos-windowH/2;
+
         // is object in view?
-        float radius = RadarOverlayElement::calcRadius(navCamPos_, currentDir_, currentOrth_, focus_);
-        bool isRight = (currentDir_.crossProduct(currentOrth_)).dotProduct(focus_->getPosition() - navCamPos_)>0;
-        bool isAbove = currentOrth_.dotProduct(focus_->getPosition() - navCamPos_)>0;
+        Vector3 navCamPos = SpaceShip::getLocalShip()->getPosition();
+        Vector3 currentDir = SpaceShip::getLocalShip()->getDir();
+        Vector3 currentOrth = SpaceShip::getLocalShip()->getOrth();
+        float radius = getAngle(navCamPos, currentDir, focus_->getPosition());
+        bool isRight = (currentDir.crossProduct(currentOrth)).dotProduct(focus_->getPosition() - navCamPos)>0;
+        bool isAbove = currentOrth.dotProduct(focus_->getPosition() - navCamPos)>0;
         bool outOfView = (xPosRel<0 || xPosRel>1 || yPosRel<0 || yPosRel>1);
         // if object is behind us, it is out of view anyway:
-        if(!outOfView && radius>3.14/2) outOfView = true;
+        if(!outOfView && radius > Ogre::Math::PI / 2) outOfView = true;
 
         if(outOfView){
@@ -119,5 +133,5 @@
             navMarker_->setMaterialName("Orxonox/NavArrows");
             navMarker_->setDimensions(16,16);
-            float phiUpperCorner = atan((float)(windowW_)/(float)(windowH_));
+            float phiUpperCorner = atan((float)(windowW)/(float)(windowH));
             // from the angle we find out on which edge to draw the marker
             // and which of the four arrows to take
@@ -128,5 +142,5 @@
                 if(-phiNav<phiUpperCorner){
                     //COUT(3) << "arrow up\n";
-                    navMarker_->setPosition(-tan(phiNav)*windowH_/2+windowW_/2, 0);
+                    navMarker_->setPosition(-tan(phiNav)*windowH/2+windowW/2, 0);
                     navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
                     navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
@@ -135,5 +149,5 @@
                 else {
                     //COUT(3) << "arrow right\n";
-                    navMarker_->setPosition(windowW_-16, tan((3.14-2*phiNav)/2)*windowW_/2+windowH_/2);
+                    navMarker_->setPosition(windowW-16, tan((3.14-2*phiNav)/2)*windowW/2+windowH/2);
                     navMarker_->setUV(0.5, 0.5, 1.0, 1.0);
                     navText_->setLeft(navMarker_->getLeft()-navMarker_->getWidth());
@@ -145,5 +159,5 @@
                 if(phiNav<phiUpperCorner) {
                     //COUT(3) << "arrow down\n";
-                    navMarker_->setPosition(tan(phiNav)*windowH_/2+windowW_/2, windowH_-16);
+                    navMarker_->setPosition(tan(phiNav)*windowH/2+windowW/2, windowH-16);
                     navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
                     navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
@@ -152,5 +166,5 @@
                 else {
                     //COUT(3) << "arrow right\n";
-                    navMarker_->setPosition(windowW_-16, tan((3.14-2*phiNav)/2)*windowW_/2+windowH_/2);
+                    navMarker_->setPosition(windowW-16, tan((3.14-2*phiNav)/2)*windowW/2+windowH/2);
                     navMarker_->setUV(0.5, 0.5, 1.0, 1.0);
                     navText_->setLeft(navMarker_->getLeft()-navMarker_->getWidth());
@@ -162,5 +176,5 @@
                 if(phiNav<phiUpperCorner){
                     //COUT(3) << "arrow up\n";
-                    navMarker_->setPosition(-tan(phiNav)*windowH_/2+windowW_/2, 0);
+                    navMarker_->setPosition(-tan(phiNav)*windowH/2+windowW/2, 0);
                     navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
                     navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
@@ -169,5 +183,5 @@
                 else {
                     //COUT(3) << "arrow left\n";
-                    navMarker_->setPosition(0, -tan((3.14-2*phiNav)/2)*windowW_/2+windowH_/2);
+                    navMarker_->setPosition(0, -tan((3.14-2*phiNav)/2)*windowW/2+windowH/2);
                     navMarker_->setUV(0.0, 0.0, 0.5, 0.5);
                     navText_->setLeft(navMarker_->getWidth());
@@ -179,5 +193,5 @@
                 if(phiNav>-phiUpperCorner) {
                     //COUT(3) << "arrow down\n";
-                    navMarker_->setPosition(tan(phiNav)*windowH_/2+windowW_/2, windowH_-16);
+                    navMarker_->setPosition(tan(phiNav)*windowH/2+windowW/2, windowH-16);
                     navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
                     navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
@@ -186,5 +200,5 @@
                 else {
                     //COUT(3) << "arrow left\n";
-                    navMarker_->setPosition(0, -tan((3.14-2*phiNav)/2)*windowW_/2+windowH_/2);
+                    navMarker_->setPosition(0, -tan((3.14-2*phiNav)/2)*windowW/2+windowH/2);
                     navMarker_->setUV(0.0, 0.0, 0.5, 0.5);
                     navText_->setLeft(navMarker_->getWidth());
@@ -205,11 +219,33 @@
     void Navigation::cycleFocus(){
         if(focus_ == NULL){
-            it_ = HUD::getSingleton().roSet.begin();
-            focus_ = *it_;
-            ++it_;
+            // Get closest object
+            float distance = (unsigned int) -1;
+            Vector3 shipPos = SpaceShip::getLocalShip()->getPosition();
+            it_ = HUD::getSingleton().getRadarObjects().begin();
+
+            for (std::list<RadarObject*>::iterator it = HUD::getSingleton().getRadarObjects().begin(); it != HUD::getSingleton().getRadarObjects().end(); ++it)
+            {
+                float newdist = (*it)->getPosition().squaredDistance(shipPos);
+                if (newdist < distance)
+                {
+                    distance = newdist;
+                    it_ = it;
+                }
+            }
+
+            if (it_ != HUD::getSingleton().getRadarObjects().end())
+            {
+                focus_ = *it_;
+
+                // move the focused object to the begin of the list, so we will iterate through all other objects when cycling
+                HUD::getSingleton().getRadarObjects().erase(it_);
+                HUD::getSingleton().getRadarObjects().insert(HUD::getSingleton().getRadarObjects().begin(), focus_);
+                it_ = HUD::getSingleton().getRadarObjects().begin();
+                ++it_;
+            }
         }
         else{
             focus_->resetMaterial();
-            if(it_ != HUD::getSingleton().roSet.end()){
+            if(it_ != HUD::getSingleton().getRadarObjects().end()){
                 focus_ = *it_;
                 ++it_;
@@ -217,4 +253,8 @@
             else focus_ = NULL;
         }
+        updateFocus();
+    }
+
+    void Navigation::updateFocus(){
         if(focus_ == NULL){
             navMarker_->hide();
@@ -228,5 +268,5 @@
     }
 
-    float Navigation::getDist2Focus(){
+    float Navigation::getDist2Focus() const {
         if(focus_ == NULL) return(0.0);
         return((focus_->getPosition()-SpaceShip::getLocalShip()->getPosition()).length());
Index: code/trunk/src/orxonox/hud/Navigation.h
===================================================================
--- code/trunk/src/orxonox/hud/Navigation.h	(revision 1563)
+++ code/trunk/src/orxonox/hud/Navigation.h	(revision 1564)
@@ -35,34 +35,34 @@
 #include <OgreTextAreaOverlayElement.h>
 #include <OgrePanelOverlayElement.h>
-#include "util/Math.h"
 
 namespace orxonox
 {
-
     class _OrxonoxExport Navigation
     {
-      private:
-        Ogre::OverlayManager* om;				            // our one and only overlay manager
-        Ogre::OverlayContainer* container_;
-        Ogre::PanelOverlayElement* navMarker_;      // the panel used to show the arrow
-        Ogre::TextAreaOverlayElement* navText_;     // displaying distance
-        Ogre::Camera* navCam_;
-        Vector3 navCamPos_;                         // position of ship
-        Vector3 currentDir_;
-        Vector3 currentOrth_;
-        std::set<RadarObject*>::iterator it_;
-        int windowW_, windowH_;
-        void init();
-        void updateMarker();
-
       public:
         Navigation(Ogre::OverlayContainer* container);
         Navigation(Ogre::OverlayContainer* container, RadarObject* focus);
         ~Navigation();
-        RadarObject* focus_;                        // next pointer of linked list
 
         void update();
         void cycleFocus();
-        float getDist2Focus();
+        float getDist2Focus() const;
+
+        inline RadarObject* getFocus() const
+            { return this->focus_; }
+        inline void setFocus(RadarObject* object)
+            { this->focus_ = object; this->updateFocus(); }
+
+      private:
+        void init();
+        void updateMarker();
+        void updateFocus();
+
+        Ogre::OverlayContainer* container_;
+        Ogre::PanelOverlayElement* navMarker_;      // the panel used to show the arrow
+        Ogre::PanelOverlayElement* aimMarker_;
+        Ogre::TextAreaOverlayElement* navText_;     // displaying distance
+        std::list<RadarObject*>::iterator it_;
+        RadarObject* focus_;                        // next pointer of linked list
   };
 }
Index: code/trunk/src/orxonox/hud/OverlayElementFactories.h
===================================================================
--- code/trunk/src/orxonox/hud/OverlayElementFactories.h	(revision 1563)
+++ code/trunk/src/orxonox/hud/OverlayElementFactories.h	(revision 1564)
@@ -39,5 +39,6 @@
 #include "RadarOverlayElement.h"
 
-namespace orxonox{
+namespace orxonox
+{
     class _OrxonoxExport BarOverlayElementFactory : public Ogre::OverlayElementFactory{
       public:
Index: code/trunk/src/orxonox/hud/RadarObject.cc
===================================================================
--- code/trunk/src/orxonox/hud/RadarObject.cc	(revision 1563)
+++ code/trunk/src/orxonox/hud/RadarObject.cc	(revision 1564)
@@ -23,5 +23,5 @@
  *      Felix Schulthess
  *   Co-authors:
- *      ...
+ *      Fabian 'x3n' Landau
  *
  */
@@ -35,4 +35,5 @@
 
 #include "GraphicsEngine.h"
+#include "objects/WorldEntity.h"
 #include "util/Convert.h"
 
@@ -43,5 +44,5 @@
     {
         public:
-            bool operator()(const orxonox::ColourValue& __x, const orxonox::ColourValue& __y)
+            bool operator()(const orxonox::ColourValue& __x, const orxonox::ColourValue& __y) const
             {
                 if (__x.r == __y.r)
@@ -68,26 +69,24 @@
     std::map<std::string, std::map<ColourValue, std::string> > RadarObject::materials_s;
 
-    RadarObject::RadarObject(Ogre::OverlayContainer* container, Ogre::SceneNode* node, const ColourValue& colour, const std::string& texturename)
+    RadarObject::RadarObject(Ogre::OverlayContainer* container, WorldEntity* object, const ColourValue& colour, const std::string& texturename)
     {
         this->colour_ = colour;
         this->texturename_ = texturename;
 
-        this->container_ = container;
-        this->node_ = node;
+        this->object_ = object;
 
-        this->panel_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "RadarObject" + getConvertedValue<unsigned int, std::string>(RadarObject::count_s)));
+        this->panel_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "RadarObject" + getConvertedValue<unsigned int, std::string>(RadarObject::count_s++)));
         this->setMaterial(colour, texturename);
 
-        this->panel_->setDimensions(3,3);
+        this->panel_->setDimensions(3, 3);
         this->panel_->setMetricsMode(Ogre::GMM_PIXELS);
         this->panel_->show();
 
-        this->index_ = count_s++;
-        this->container_->addChild(panel_);
+        container->addChild(panel_);
     }
 
     RadarObject::~RadarObject()
     {
-        delete panel_;
+        Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->panel_);
     }
 
@@ -116,12 +115,12 @@
     }
 
-    Vector3 RadarObject::getPosition()
+    const Vector3& RadarObject::getPosition() const
     {
-        return node_->getPosition();
+        return this->object_->getPosition();
     }
 
-    Ogre::SceneNode* RadarObject::getNode()
+    const Vector3& RadarObject::getVelocity() const
     {
-        return node_;
+        return this->object_->getVelocity();
     }
 }
Index: code/trunk/src/orxonox/hud/RadarObject.h
===================================================================
--- code/trunk/src/orxonox/hud/RadarObject.h	(revision 1563)
+++ code/trunk/src/orxonox/hud/RadarObject.h	(revision 1564)
@@ -23,5 +23,5 @@
  *      Felix Schulthess
  *   Co-authors:
- *      ...
+ *      Fabian 'x3n' Landau
  *
  */
@@ -30,10 +30,9 @@
 #define _RadarObject_H__
 
+#include "OrxonoxPrereqs.h"
+
 #include <map>
+#include <OgrePanelOverlayElement.h>
 
-#include <OgrePrerequisites.h>
-#include <OgreSceneNode.h>
-#include <OgrePanelOverlayElement.h>
-#include "OrxonoxPrereqs.h"
 #include "util/Math.h"
 
@@ -43,5 +42,5 @@
     {
       public:
-        RadarObject(Ogre::OverlayContainer* container, Ogre::SceneNode* node, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1), const std::string& texturename = "white.tga");
+        RadarObject(Ogre::OverlayContainer* container, WorldEntity* object, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1), const std::string& texturename = "white.tga");
         ~RadarObject();
 
@@ -54,11 +53,11 @@
             { this->setMaterial(this->colour_, this->texturename_); }
 
-        Vector3 getPosition();
-        Ogre::SceneNode* getNode();
+        const Vector3& getPosition() const;
+        const Vector3& getVelocity() const;
 
-        bool right_;
-        int index_;                             // index number of object
-        Ogre::OverlayContainer* container_;
-        Ogre::PanelOverlayElement* panel_;		// the panel used to show the dot
+        inline WorldEntity* getObject() const
+            { return this->object_; }
+        inline Ogre::PanelOverlayElement* getPanel() const
+            { return this->panel_; }
 
       private:
@@ -66,8 +65,11 @@
         static unsigned int count_s;
         static unsigned int materialcount_s;
-        Ogre::SceneNode* node_;					// node of object
+
+        WorldEntity* object_;					// the object
         ColourValue colour_;
         std::string texturename_;
-  };
+
+        Ogre::PanelOverlayElement* panel_;		// the panel used to show the dot
+    };
 }
 
Index: code/trunk/src/orxonox/hud/RadarOverlayElement.cc
===================================================================
--- code/trunk/src/orxonox/hud/RadarOverlayElement.cc	(revision 1563)
+++ code/trunk/src/orxonox/hud/RadarOverlayElement.cc	(revision 1564)
@@ -34,8 +34,10 @@
 #include <OgreStringConverter.h>
 
-#include "GraphicsEngine.h"
 #include "core/ConsoleCommand.h"
 #include "objects/Tickable.h"
 #include "objects/SpaceShip.h"
+#include "util/Math.h"
+
+#include "GraphicsEngine.h"
 #include "RadarObject.h"
 #include "HUD.h"
@@ -53,9 +55,7 @@
     void RadarOverlayElement::init(Real leftRel, Real topRel, Real dimRel, OverlayContainer* container){
         // some initial data
-        om = &OverlayManager::getSingleton();
         dimRel_ = dimRel;
         leftRel_ = leftRel;
         topRel_ = topRel;
-        container_ = container;
 
         setMetricsMode(GMM_PIXELS);
@@ -63,14 +63,12 @@
         resize();
 
-        container_->addChild(this);
+        container->addChild(this);
     }
 
     void RadarOverlayElement::resize() {
         // if window is resized, we must adapt these...
-        windowW_ = GraphicsEngine::getSingleton().getWindowWidth();
-        windowH_ = GraphicsEngine::getSingleton().getWindowHeight();
-        dim_ = (int) (dimRel_*windowH_);
-        left_ = (int) (leftRel_*windowW_-dim_/2);
-        top_ = (int) (topRel_*windowH_-dim_/2);
+        dim_ = (int) (dimRel_*GraphicsEngine::getSingleton().getWindowHeight());
+        left_ = (int) (leftRel_*GraphicsEngine::getSingleton().getWindowWidth()-dim_/2);
+        top_ = (int) (topRel_*GraphicsEngine::getSingleton().getWindowHeight()-dim_/2);
         setPosition(left_, top_);
         setDimensions(dim_,dim_);
@@ -78,57 +76,32 @@
 
     void RadarOverlayElement::update() {
-        shipPos_ = SpaceShip::getLocalShip()->getPosition();
-        currentDir_ = SpaceShip::getLocalShip()->getDir();
-        currentOrth_ = SpaceShip::getLocalShip()->getOrth();
         // iterate through all RadarObjects
-        for(std::set<RadarObject*>::iterator it=HUD::getSingleton().roSet.begin(); it!=HUD::getSingleton().roSet.end(); it++){
-        // calc position on radar...
-            float radius = calcRadius(shipPos_, currentDir_, currentOrth_, (*it));
-            float phi = calcPhi(shipPos_, currentDir_, currentOrth_, (*it));
-            bool right = calcRight(shipPos_, currentDir_, currentOrth_, (*it));
+        for(std::list<RadarObject*>::iterator it=HUD::getSingleton().getRadarObjects().begin(); it!=HUD::getSingleton().getRadarObjects().end(); it++)
+        {
+            // calc position on radar...
+            // set size to fit distance...
+            float distance = ((*it)->getPosition() - SpaceShip::getLocalShip()->getPosition()).length();
+            if (distance > 20000) (*it)->getPanel()->setDimensions(1, 1);
+            else if (distance > 10000) (*it)->getPanel()->setDimensions(2, 2);
+            else if (distance > 5000) (*it)->getPanel()->setDimensions(3, 3);
+            else if (distance > 2500) (*it)->getPanel()->setDimensions(4, 4);
+            else if (distance > 1000) (*it)->getPanel()->setDimensions(5, 5);
+            else (*it)->getPanel()->setDimensions(6,6);
 
-            // set size to fit distance...
-            float d = ((*it)->getPosition()-shipPos_).length();
-            if(d<10000) (*it)->panel_->setDimensions(4,4);
-            else if(d<20000) (*it)->panel_->setDimensions(3,3);
-            else (*it)->panel_->setDimensions(2,2);
-
-            if (right){
-                (*it)->panel_->setPosition(sin(phi)*radius/
-                    3.5*dim_/2+dim_/2+left_-2,-cos(phi)*radius/3.5*dim_/2+dim_/2+top_-2);
-            }
-            else {
-                (*it)->panel_->setPosition(-sin(phi)*radius/
-                    3.5*dim_/2+dim_/2+left_-2,-cos(phi)*radius/3.5*dim_/2+dim_/2+top_-2);
-            }
+            Vector2 coord = get2DViewcoordinates(SpaceShip::getLocalShip()->getPosition(), SpaceShip::getLocalShip()->getDir(), SpaceShip::getLocalShip()->getOrth(), (*it)->getPosition());
+            coord = coord * Ogre::Math::PI / 3.5; // small adjustment to make it fit the texture
+            float dimfactor = dim_ / 2.0;
+            (*it)->getPanel()->setPosition((1 + coord.x) * dimfactor + left_ - 2,
+                                           (1 - coord.y) * dimfactor + top_ - 2);
         }
     }
 
-    void RadarOverlayElement::listObjects(){
+    void RadarOverlayElement::listObjects() const {
         int i = 0;
         COUT(3) << "List of RadarObjects:\n";
         // iterate through all Radar Objects
-        for(std::set<RadarObject*>::iterator it=HUD::getSingleton().roSet.begin(); it!=HUD::getSingleton().roSet.end(); it++){
+        for(std::list<RadarObject*>::const_iterator it=HUD::getSingleton().getRadarObjects().begin(); it!=HUD::getSingleton().getRadarObjects().end(); ++it){
             COUT(3) << i++ << ": " << (*it)->getPosition() << std::endl;
         }
     }
-
-    float RadarOverlayElement::calcRadius(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
-        return(acos((dir.dotProduct(obj->getPosition() - pos))/
-        ((obj->getPosition() - pos).length()*dir.length())));
-    }
-
-    float RadarOverlayElement::calcPhi(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
-        // project difference vector on our plane...
-        Vector3 proj = Plane(dir, pos).projectVector(obj->getPosition() - pos);
-        // ...and find out the angle
-        return(acos((orth.dotProduct(proj))/
-              (orth.length()*proj.length())));
-    }
-
-    bool RadarOverlayElement::calcRight(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
-        if((dir.crossProduct(orth)).dotProduct(obj->getPosition() - pos) > 0)
-            return true;
-        else return false;
-    }
 }
Index: code/trunk/src/orxonox/hud/RadarOverlayElement.h
===================================================================
--- code/trunk/src/orxonox/hud/RadarOverlayElement.h	(revision 1563)
+++ code/trunk/src/orxonox/hud/RadarOverlayElement.h	(revision 1564)
@@ -40,15 +40,4 @@
     class _OrxonoxExport RadarOverlayElement : public Ogre::PanelOverlayElement
     {
-      private:
-        Ogre::OverlayManager* om;               // our one and only overlay manager
-        Ogre::OverlayContainer* container_;     // pointer to the container we're in
-        Vector3 currentDir_;
-        Vector3 currentOrth_;
-        Vector3 shipPos_;                       // position of ship
-
-        Ogre::Real leftRel_, topRel_, dimRel_;  // relative position/dimension
-        int left_, top_, dim_;                  // absolute position/dimension
-        int windowW_, windowH_;             	  // absolute window dimensions
-
       public:
         RadarOverlayElement(const Ogre::String& name);
@@ -57,9 +46,9 @@
         void resize();
         void update();
-        void listObjects();
+        void listObjects() const;
 
-        static float calcRadius(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj);
-        static float calcPhi(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj);
-        static bool calcRight(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj);
+      private:
+        Ogre::Real leftRel_, topRel_, dimRel_;  // relative position/dimension
+        int left_, top_, dim_;                  // absolute position/dimension
   };
 }
Index: code/trunk/src/orxonox/objects/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1563)
+++ code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1564)
@@ -152,5 +152,5 @@
 
             if (!this->myShip_)
-                HUD::getSingleton().removeRadarObject(this->getNode());
+                HUD::getSingleton().removeRadarObject(this);
         }
     }
@@ -161,5 +161,5 @@
           myShip_=true;
         else
-          HUD::getSingleton().addRadarObject(this->getNode(), this->getProjectileColour());
+          HUD::getSingleton().addRadarObject(this, this->getProjectileColour());
       }
       if(Model::create())
@@ -508,7 +508,8 @@
           this->mouseXRotation_ = Radian(0);
           this->mouseYRotation_ = Radian(0);
-          this->bLMousePressed_ = false;
         }/*else
           COUT(4) << "not steering ship: " << objectID << " our ship: " << network::Client::getSingleton()->getShipID() << std::endl;*/
+
+          this->bLMousePressed_ = false;
     }
 
Index: code/trunk/src/orxonox/objects/SpaceShipAI.cc
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShipAI.cc	(revision 1563)
+++ code/trunk/src/orxonox/objects/SpaceShipAI.cc	(revision 1564)
@@ -226,5 +226,5 @@
             this->moveToTargetPosition(dt);
 
-        if (this->bShooting_ && this->isCloseAtTarget(2500) && this->isLookingAtTarget(Ogre::Math::PI / 10))
+        if (this->bShooting_ && this->isCloseAtTarget(2500) && this->isLookingAtTarget(Ogre::Math::PI / 20.0))
             this->doFire();
 
@@ -234,20 +234,15 @@
     void SpaceShipAI::moveToTargetPosition(float dt)
     {
-        Vector3 proj = Ogre::Plane(this->getDir(), this->getPosition()).projectVector(this->targetPosition_ - this->getPosition());
-        float angle = acos((this->getOrth().dotProduct(proj)) / (this->getOrth().length()*proj.length()));
-
-        if ((this->getDir().crossProduct(this->getOrth())).dotProduct(this->targetPosition_ - this->getPosition()) > 0)
-            this->setMoveYaw(sgn(sin(angle)));
-        else
-            this->setMoveYaw(-sgn(sin(angle)));
-        this->setMovePitch(sgn(cos(angle)));
+        Vector2 coord = get2DViewdirection(this->getPosition(), this->getDir(), this->getOrth(), this->targetPosition_);
+        this->setMoveYaw(0.8 * sgn(coord.x));
+        this->setMovePitch(0.8 * sgn(coord.y));
 
         if ((this->targetPosition_ - this->getPosition()).length() > 300)
-            this->setMoveLongitudinal(1);
+            this->setMoveLongitudinal(0.8);
 
         if (this->isCloseAtTarget(300) && this->target_)
         {
             if (this->getVelocity().length() > this->target_->getVelocity().length())
-                this->setMoveLongitudinal(-1);
+                this->setMoveLongitudinal(-0.5);
         }
     }
@@ -319,6 +314,5 @@
     bool SpaceShipAI::isLookingAtTarget(float angle)
     {
-        Vector3 dist = this->targetPosition_ - this->getPosition();
-        return (acos((this->getDir().dotProduct(dist)) / (dist.length() * this->getDir().length())) < angle);
+        return (getAngle(this->getPosition(), this->getDir(), this->targetPosition_) < angle);
     }
 
Index: code/trunk/src/util/Math.cc
===================================================================
--- code/trunk/src/util/Math.cc	(revision 1563)
+++ code/trunk/src/util/Math.cc	(revision 1564)
@@ -26,4 +26,6 @@
  *
  */
+
+#include <OgrePlane.h>
 
 #include "Math.h"
@@ -68,2 +70,38 @@
     return in;
 }
+
+
+float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition)
+{
+    orxonox::Vector3 distance = otherposition - myposition;
+    return acos(mydirection.dotProduct(distance) / distance.length());
+}
+
+orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
+{
+    orxonox::Vector3 distance = otherposition - myposition;
+
+    // project difference vector on our plane
+    orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
+    float angle = acos(myorthonormal.dotProduct(projection) / projection.length());
+
+    if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
+        return orxonox::Vector2(sin(angle), cos(angle));
+    else
+        return orxonox::Vector2(-sin(angle), cos(angle));
+}
+
+orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
+{
+    orxonox::Vector3 distance = otherposition - myposition;
+
+    // project difference vector on our plane
+    orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
+    float angle = acos(myorthonormal.dotProduct(projection) / projection.length());
+    float radius = acos(mydirection.dotProduct(distance) / distance.length()) / Ogre::Math::PI;
+
+    if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
+        return orxonox::Vector2(sin(angle) * radius, cos(angle) * radius);
+    else
+        return orxonox::Vector2(-sin(angle) * radius, cos(angle) * radius);
+}
Index: code/trunk/src/util/Math.h
===================================================================
--- code/trunk/src/util/Math.h	(revision 1563)
+++ code/trunk/src/util/Math.h	(revision 1564)
@@ -58,4 +58,8 @@
 _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Degree& degree);
 _UtilExport std::istream& operator>>(std::istream& in, orxonox::Degree& degree);
+
+_UtilExport float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition);
+_UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
+_UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
 
 template <typename T>
