Index: code/trunk/src/orxonox/hud/HUD.cc
===================================================================
--- code/trunk/src/orxonox/hud/HUD.cc	(revision 1396)
+++ code/trunk/src/orxonox/hud/HUD.cc	(revision 1399)
@@ -64,8 +64,9 @@
         fpsText = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "fpsText"));
         fpsText->show();
-        fpsText->setMetricsMode(Ogre::GMM_RELATIVE);
-        fpsText->setDimensions(0.3, 0.3);
-        fpsText->setPosition(0.9, 0.02);
+        fpsText->setMetricsMode(Ogre::GMM_PIXELS);
+        fpsText->setDimensions(0.001, 0.001);
+        fpsText->setPosition(10, 10);
         fpsText->setFontName("Console");
+        fpsText->setCharHeight(20);
         fpsText->setCaption("init");
 
Index: code/trunk/src/orxonox/hud/Navigation.cc
===================================================================
--- code/trunk/src/orxonox/hud/Navigation.cc	(revision 1396)
+++ code/trunk/src/orxonox/hud/Navigation.cc	(revision 1399)
@@ -27,7 +27,12 @@
 
 #include <OgreOverlayManager.h>
+#include <OgrePanelOverlayElement.h>
+#include <OgreTextAreaOverlayElement.h>
 #include <OgreStringConverter.h>
+#include <OgreMatrix4.h>
 #include <GraphicsEngine.h>
+#include "core/Iterator.h"
 #include "objects/SpaceShip.h"
+#include "objects/CameraHandler.h"
 #include "HUD.h"
 #include "Navigation.h"
@@ -51,11 +56,20 @@
     void Navigation::init(){
 		om = &OverlayManager::getSingleton();
+//		for (Iterator<Model> it = ObjectList<Model>::begin(); it; ++it)
+//		{
+//            if(it->getPosition() == Vector(2000.0, 1000.0, 1000.0)){
+//                COUT(3) << "TARGET FOUND\n";
+//
+//
+//        }
+		cam_ = NULL;
         // create nav text
         navText_ = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "navText"));
         navText_->show();
-        navText_->setMetricsMode(Ogre::GMM_RELATIVE);
-        navText_->setDimensions(0.3, 0.3);
+        navText_->setMetricsMode(Ogre::GMM_PIXELS);
+        navText_->setDimensions(0.001, 0.001);
         navText_->setPosition(0.02, 0.02);
         navText_->setFontName("Console");
+        navText_->setCharHeight(20);
         navText_->setCaption("");
         container_->addChild(navText_);
@@ -65,7 +79,6 @@
         navMarker_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel", "NavMarker"));
         navMarker_->setMetricsMode(GMM_PIXELS);
-        navMarker_->setMaterialName("Orxonox/NavMarker");
-        navMarker_->setDimensions(16,16);
         navMarker_->hide();
+        navText_->hide();
         container_->addChild(navMarker_);
 	}
@@ -73,44 +86,92 @@
 	void Navigation::update(){
         if(focus_ == NULL) return;
-        shipPos_ = SpaceShip::instance_s->getPosition();
+        shipPos_ = SpaceShip::getLocalShip()->getPosition();
         windowW_ = GraphicsEngine::getSingleton().getWindowWidth();
         windowH_ = GraphicsEngine::getSingleton().getWindowHeight();
-        // from the angle we find out where to draw the marker
-        // and which of the four arrows to take
-        float r1 = atan((float)(windowW_)/(float)(windowH_));
-        float phi = focus_->phi_;
-        if(focus_->right_){
-            if(phi<r1){
-                navMarker_->setPosition(tan(phi)*windowH_/2+windowW_/2, 0);
-                navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
+        updateMarker();
+    }
+
+    void Navigation::updateMarker(){
+        // set text
+        int dist = (float)(getDist2Focus()/100);
+        navText_->setCaption(Ogre::StringConverter::toString(dist));
+
+        if(cam_ == NULL) cam_ = SpaceShip::getLocalShip()->getCamera()->cam_;
+        Vector3 pos = focus_->pos_;
+        // transform to screen coordinates
+        pos = cam_->getProjectionMatrix()*cam_->getViewMatrix()*pos;
+        float xPosRel = 0.5*pos.x+0.5;
+        float yPosRel = 1-(0.5*pos.y+0.5);
+        int xPos = xPosRel*windowW_;
+        int yPos = yPosRel*windowH_;
+        // is object in view?
+        bool outOfView = (xPosRel<0 || xPosRel>1 || yPosRel<0 || yPosRel>1);
+        // if object is behind us, it is out of view anyway:
+        if(!outOfView && focus_->radius_>3.14/2) outOfView = true;
+
+        if(outOfView){
+            // NO!
+            navMarker_->setMaterialName("Orxonox/NavArrows");
+            navMarker_->setDimensions(16,16);
+            float phiUpRight = atan((float)(windowW_)/(float)(windowH_));
+            // from the angle we find out where to draw the marker
+            // and which of the four arrows to take
+            float phi = focus_->phi_;
+            if(focus_->right_){
+                if(phi<phiUpRight){
+                    // arrow up
+                    navMarker_->setPosition(tan(phi)*windowH_/2+windowW_/2, 0);
+                    navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
+                    navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getHeight());
+                }
+                else if(phi>3.14-phiUpRight){
+                    // arrow down
+                    navMarker_->setPosition(-tan(phi)*windowH_/2+windowW_/2, windowH_-16);
+                    navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
+                    navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getTop()-navMarker_->getHeight());
+                }
+                else {
+                    // arrow right
+                    navMarker_->setPosition(windowW_-16, -tan((3.14-2*phi)/2)*windowW_/2+windowH_/2);
+                    navMarker_->setUV(0.5, 0.5, 1.0, 1.0);
+                    navText_->setLeft(navMarker_->getLeft()-navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getTop()+navMarker_->getHeight());
+                }
             }
-            else if(phi>3.14-r1){
-                navMarker_->setPosition(-tan(phi)*windowH_/2+windowW_/2, windowH_-16);
-                navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
+            else{
+                if(phi<phiUpRight) {
+                    // arrow up
+                    navMarker_->setPosition(-tan(phi)*windowH_/2+windowW_/2, 0);
+                    navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
+                    navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getHeight());
+                }
+                else if(phi>3.14-phiUpRight) {
+                    // arrow down
+                    navMarker_->setPosition(tan(phi)*windowH_/2+windowW_/2, windowH_-16);
+                    navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
+                    navText_->setLeft(navMarker_->getLeft()+navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getTop()-navMarker_->getHeight());
+                }
+                else {
+                    // arrow left
+                    navMarker_->setPosition(0, -tan((3.14-2*phi)/2)*windowW_/2+windowH_/2);
+                    navMarker_->setUV(0.0, 0.0, 0.5, 0.5);
+                    navText_->setLeft(navMarker_->getWidth());
+                    navText_->setTop(navMarker_->getTop()+navMarker_->getHeight());
+                }
             }
-            else {
-                navMarker_->setPosition(windowW_-16, -tan((3.14-2*phi)/2)*windowW_/2+windowH_/2);
-                navMarker_->setUV(0.5, 0.5, 1.0, 1.0);
-            }
         }
         else{
-            if(phi<r1) {
-                navMarker_->setPosition(-tan(phi)*windowH_/2+windowW_/2, 0);
-                navMarker_->setUV(0.5, 0.0, 1.0, 0.5);
-            }
-            else if(phi>3.14-r1) {
-                navMarker_->setPosition(tan(phi)*windowH_/2+windowW_/2, windowH_-16);
-                navMarker_->setUV(0.0, 0.5, 0.5, 1.0);
-            }
-            else {
-                navMarker_->setPosition(0, -tan((3.14-2*phi)/2)*windowW_/2+windowH_/2);
-                navMarker_->setUV(0.0, 0.0, 0.5, 0.5);
-            }
-        }
-
-        int d = (float)(getDist2Focus()/10);
-        if(d) navText_->setCaption("Distance: " + Ogre::StringConverter::toString(d));
-        else navText_->setCaption("");
-    }
+            // YES!
+            navMarker_->setMaterialName("Orxonox/NavTDC");
+            navMarker_->setDimensions(24,24);
+            navMarker_->setUV(0.0,0.0,1.0,1.0);
+            navMarker_->setPosition(xPos-navMarker_->getWidth()/2, yPos-navMarker_->getHeight()/2);
+            navText_->setPosition(xPos+navMarker_->getWidth()/2, yPos+navMarker_->getHeight()/2);
+        }
+	}
 
     void Navigation::cycleFocus(){
@@ -120,12 +181,14 @@
         else{
             focus_->panel_->setMaterialName("Orxonox/RedDot");
-            focus_ = focus_->next;
+            if(focus_ != NULL) focus_ = focus_->next;
         }
 
         if(focus_ == NULL){
             navMarker_->hide();
+            navText_->hide();
         }
         else{
             navMarker_->show();
+            navText_->show();
             focus_->panel_->setMaterialName("Orxonox/WhiteDot");
         }
Index: code/trunk/src/orxonox/hud/Navigation.h
===================================================================
--- code/trunk/src/orxonox/hud/Navigation.h	(revision 1396)
+++ code/trunk/src/orxonox/hud/Navigation.h	(revision 1399)
@@ -20,5 +20,5 @@
 *
 *   Author:
-*      Yuning Chai
+*      Felix Schulthess
 *   Co-authors:
 *      ...
@@ -30,6 +30,4 @@
 
 #include <OgrePrerequisites.h>
-#include <OgrePanelOverlayElement.h>
-#include <OgreTextAreaOverlayElement.h>
 #include "../OrxonoxPrereqs.h"
 #include "util/Math.h"
@@ -44,9 +42,12 @@
             Ogre::OverlayContainer* container_;
             Ogre::PanelOverlayElement* navMarker_;      // the panel used to show the arrow
-            Ogre::TextAreaOverlayElement* navText_;      // displaying distance...
+            Ogre::TextAreaOverlayElement* navText_;     // displaying distance
+            Ogre::MovableObject* movo_;
+            Ogre::Camera* cam_;
     		Vector3 shipPos_;                           // position of ship
     		int windowW_, windowH_;
 
     		void init();
+    		void updateMarker();
 
     	public:
Index: code/trunk/src/orxonox/hud/RadarOverlayElement.cc
===================================================================
--- code/trunk/src/orxonox/hud/RadarOverlayElement.cc	(revision 1396)
+++ code/trunk/src/orxonox/hud/RadarOverlayElement.cc	(revision 1399)
@@ -113,5 +113,4 @@
                     3.5*dim_/2+dim_/2+left_-2,-cos(ro->phi_)*ro->radius_/3.5*dim_/2+dim_/2+top_-2);
             }
-            listObjects();
             ro = ro->next;
 		}
Index: code/trunk/src/orxonox/objects/Camera.h
===================================================================
--- code/trunk/src/orxonox/objects/Camera.h	(revision 1396)
+++ code/trunk/src/orxonox/objects/Camera.h	(revision 1399)
@@ -50,4 +50,6 @@
         void setTargetNode(Ogre::SceneNode* obj);
 
+        Ogre::Camera* cam_;
+
         void tick(float dt);
         void update();
@@ -63,5 +65,4 @@
         Ogre::SceneNode* cameraNode_;
         Ogre::Vector3 oldPos;
-        Ogre::Camera* cam_;
         bool bHasFocus_;
     };
Index: code/trunk/src/orxonox/objects/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1396)
+++ code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1399)
@@ -69,5 +69,5 @@
       return NULL;
     }
-    
+
     SpaceShip::SpaceShip() :
       //testvector_(0,0,0),
@@ -239,4 +239,8 @@
     }
 
+    Camera* SpaceShip::getCamera(){
+        return cam_;
+    }
+
     void SpaceShip::createCamera(){
 //       COUT(4) << "begin camera creation" << std::endl;
@@ -422,7 +426,7 @@
         if (this->bLMousePressed_ && this->timeToReload_ <= 0)
         {
-          
+
             Projectile *p = new Projectile(this);
-            
+
             p->setBacksync(true);
             this->timeToReload_ = this->reloadTime_;
Index: code/trunk/src/orxonox/objects/SpaceShip.h
===================================================================
--- code/trunk/src/orxonox/objects/SpaceShip.h	(revision 1396)
+++ code/trunk/src/orxonox/objects/SpaceShip.h	(revision 1399)
@@ -44,7 +44,7 @@
     {
         public:
-          
+
             static SpaceShip *getLocalShip();
-            
+
             SpaceShip();
             ~SpaceShip();
@@ -66,4 +66,5 @@
 
             void getFocus();
+            Camera* getCamera();
             static SpaceShip* instance_s;
             static Vector3 getSPosition();
