Index: /code/trunk/bin/levels/sample.oxw
===================================================================
--- /code/trunk/bin/levels/sample.oxw	(revision 1399)
+++ /code/trunk/bin/levels/sample.oxw	(revision 1400)
@@ -12,7 +12,7 @@
 <Skybox src="Orxonox/Starbox" />
 <SpaceShip camera="true" position="0,0,0" scale="10" yawpitchroll="0,0,0" mesh="assff.mesh" maxSpeed="500" maxSideAndBackSpeed="50" maxRotation="1.0" transAcc="200" rotAcc="3.0" transDamp="75" rotDamp="1.0" />
-<Model position="2000,1000,1000" scale="10" mesh="tomato.mesh" yawpitchroll="-40,30,0" rotationAxis="1,0,0" rotationRate="-30"/>
-<Model position="0,4200,0" scale="10" mesh="tomato.mesh" yawpitchroll="-50,60,0" rotationAxis="1,0,0" rotationRate="-30"/>
-<Model position="0,0,6800" scale="10" mesh="tomato.mesh" yawpitchroll="-50,-30,0" rotationAxis="1,0,0" rotationRate="-30"/>
+<Model position="2000,0,0" scale="10" mesh="tomato.mesh" yawpitchroll="-40,30,0" rotationAxis="1,0,0" rotationRate="-30"/>
+<Model position="0,2000,0" scale="10" mesh="tomato.mesh" yawpitchroll="-50,60,0" rotationAxis="1,0,0" rotationRate="-30"/>
+<Model position="0,0,2000" scale="10" mesh="tomato.mesh" yawpitchroll="-50,-30,0" rotationAxis="1,0,0" rotationRate="-30"/>
 <NPC position="0,100,400" scale="1" mesh="razor.mesh"/>
 <NPC position="0,100,400" scale="1" mesh="razor.mesh"/>
Index: /code/trunk/src/orxonox/hud/HUD.cc
===================================================================
--- /code/trunk/src/orxonox/hud/HUD.cc	(revision 1399)
+++ /code/trunk/src/orxonox/hud/HUD.cc	(revision 1400)
@@ -102,7 +102,7 @@
 
         radar->init(0.5, 0.9, 0.2, container);
-        addRadarObject(Vector3(2000.0, 1000.0, 1000.0));
-        addRadarObject(Vector3(0.0, 4000.0, 0.0));
-        addRadarObject(Vector3(0.0, 0.0, 6800.0));
+        addRadarObject(Vector3(2000.0, 0.0, 0.0));
+        addRadarObject(Vector3(0.0, 2000.0, 0.0));
+        addRadarObject(Vector3(0.0, 0.0, 2000.0));
     }
 
Index: /code/trunk/src/orxonox/hud/Navigation.cc
===================================================================
--- /code/trunk/src/orxonox/hud/Navigation.cc	(revision 1399)
+++ /code/trunk/src/orxonox/hud/Navigation.cc	(revision 1400)
@@ -30,7 +30,5 @@
 #include <OgreTextAreaOverlayElement.h>
 #include <OgreStringConverter.h>
-#include <OgreMatrix4.h>
 #include <GraphicsEngine.h>
-#include "core/Iterator.h"
 #include "objects/SpaceShip.h"
 #include "objects/CameraHandler.h"
@@ -56,12 +54,5 @@
     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;
+		navCam_ = NULL;
         // create nav text
         navText_ = static_cast<TextAreaOverlayElement*>(om->createOverlayElement("TextArea", "navText"));
@@ -86,5 +77,8 @@
 	void Navigation::update(){
         if(focus_ == NULL) return;
-        shipPos_ = SpaceShip::getLocalShip()->getPosition();
+        navCamPos_ = SpaceShip::getLocalShip()->getPosition();
+        currentDir_ = SpaceShip::getLocalShip()->getDir();
+		currentOrth_ = SpaceShip::getLocalShip()->getOrth();
+
         windowW_ = GraphicsEngine::getSingleton().getWindowWidth();
         windowH_ = GraphicsEngine::getSingleton().getWindowHeight();
@@ -97,8 +91,8 @@
         navText_->setCaption(Ogre::StringConverter::toString(dist));
 
-        if(cam_ == NULL) cam_ = SpaceShip::getLocalShip()->getCamera()->cam_;
+        if(navCam_ == NULL) navCam_ = SpaceShip::getLocalShip()->getCamera()->cam_;
         Vector3 pos = focus_->pos_;
         // transform to screen coordinates
-        pos = cam_->getProjectionMatrix()*cam_->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);
@@ -108,5 +102,5 @@
         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 && RadarOverlayElement::calcRadius(navCamPos_, currentDir_, currentOrth_, focus_)>3.14/2) outOfView = true;
 
         if(outOfView){
@@ -117,16 +111,17 @@
             // 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){
+            float phiNav = RadarOverlayElement::calcPhi(navCamPos_, currentDir_, currentOrth_, focus_);
+            bool right = RadarOverlayElement::calcRight(navCamPos_, currentDir_, currentOrth_, focus_);
+            if(right){
+                if(phiNav<phiUpRight){
                     // arrow up
-                    navMarker_->setPosition(tan(phi)*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());
                     navText_->setTop(navMarker_->getHeight());
                 }
-                else if(phi>3.14-phiUpRight){
+                else if(phiNav>3.14-phiUpRight){
                     // arrow down
-                    navMarker_->setPosition(-tan(phi)*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());
@@ -135,5 +130,5 @@
                 else {
                     // arrow right
-                    navMarker_->setPosition(windowW_-16, -tan((3.14-2*phi)/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());
@@ -142,14 +137,14 @@
             }
             else{
-                if(phi<phiUpRight) {
+                if(phiNav<phiUpRight) {
                     // arrow up
-                    navMarker_->setPosition(-tan(phi)*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());
                     navText_->setTop(navMarker_->getHeight());
                 }
-                else if(phi>3.14-phiUpRight) {
+                else if(phiNav>3.14-phiUpRight) {
                     // arrow down
-                    navMarker_->setPosition(tan(phi)*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());
@@ -158,5 +153,5 @@
                 else {
                     // arrow left
-                    navMarker_->setPosition(0, -tan((3.14-2*phi)/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());
@@ -197,5 +192,5 @@
 	float Navigation::getDist2Focus(){
 	    if(focus_ == NULL) return(0.0);
-	    return((focus_->pos_-shipPos_).length());
+	    return((focus_->pos_-SpaceShip::getLocalShip()->getPosition()).length());
 	}
 }
Index: /code/trunk/src/orxonox/hud/Navigation.h
===================================================================
--- /code/trunk/src/orxonox/hud/Navigation.h	(revision 1399)
+++ /code/trunk/src/orxonox/hud/Navigation.h	(revision 1400)
@@ -31,4 +31,5 @@
 #include <OgrePrerequisites.h>
 #include "../OrxonoxPrereqs.h"
+#include <OgrePlane.h>
 #include "util/Math.h"
 #include "RadarObject.h"
@@ -43,9 +44,9 @@
             Ogre::PanelOverlayElement* navMarker_;      // the panel used to show the arrow
             Ogre::TextAreaOverlayElement* navText_;     // displaying distance
-            Ogre::MovableObject* movo_;
-            Ogre::Camera* cam_;
-    		Vector3 shipPos_;                           // position of ship
+            Ogre::Camera* navCam_;
+    		Vector3 navCamPos_;                            // position of ship
+    		Vector3 currentDir_;
+            Vector3 currentOrth_;
     		int windowW_, windowH_;
-
     		void init();
     		void updateMarker();
Index: /code/trunk/src/orxonox/hud/RadarObject.h
===================================================================
--- /code/trunk/src/orxonox/hud/RadarObject.h	(revision 1399)
+++ /code/trunk/src/orxonox/hud/RadarObject.h	(revision 1400)
@@ -47,5 +47,4 @@
             int index_;                             // index number of object
     		Vector3 pos_;							// position in space
-			Ogre::Real radius_, phi_;				// position on radar
 			Ogre::OverlayContainer* container_;
 			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 1399)
+++ /code/trunk/src/orxonox/hud/RadarOverlayElement.cc	(revision 1400)
@@ -59,12 +59,4 @@
         container_ = container;
 
-        // these have to fit the data in the level
-        shipPos_ = Vector3(0.0, 0.0, 0.0);
-        initialDir_ = Vector3(1.0, 0.0, 0.0);
-        currentDir_ = initialDir_;
-        initialOrth_ = Vector3(0.0, 0.0, 1.0);
-        currentOrth_ = initialOrth_;
-        plane = Plane(currentDir_, shipPos_);
-
         setMetricsMode(GMM_PIXELS);
         setMaterialName("Orxonox/Radar");
@@ -86,15 +78,14 @@
 
     void RadarOverlayElement::update() {
-        shipPos_ = SpaceShip::instance_s->getPosition();
-        currentDir_ = SpaceShip::instance_s->getOrientation()*initialDir_;
-		currentOrth_ = SpaceShip::instance_s->getOrientation()*initialOrth_;
-        plane = Plane(currentDir_, shipPos_);
+        shipPos_ = SpaceShip::getLocalShip()->getPosition();
+        currentDir_ = SpaceShip::getLocalShip()->getDir();
+		currentOrth_ = SpaceShip::getLocalShip()->getOrth();
         RadarObject* ro = HUD::getSingleton().getFirstRadarObject();
         // iterate through all RadarObjects
 		while(ro != NULL){
 		    // calc position on radar...
-            ro->radius_ = calcRadius(ro);
-            ro->phi_ = calcPhi(ro);
-            ro->right_ = calcRight(ro);
+            float radius = calcRadius(shipPos_, currentDir_, currentOrth_, ro);
+            float phi = calcPhi(shipPos_, currentDir_, currentOrth_, ro);
+            bool right = calcRight(shipPos_, currentDir_, currentOrth_, ro);
 
             // set size to fit distance...
@@ -105,11 +96,11 @@
             else ro->panel_->setDimensions(1,1);
 
-            if (ro->right_){
-                ro->panel_->setPosition(sin(ro->phi_)*ro->radius_/
-                    3.5*dim_/2+dim_/2+left_-2,-cos(ro->phi_)*ro->radius_/3.5*dim_/2+dim_/2+top_-2);
+            if (right){
+                ro->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 {
-                ro->panel_->setPosition(-sin(ro->phi_)*ro->radius_/
-                    3.5*dim_/2+dim_/2+left_-2,-cos(ro->phi_)*ro->radius_/3.5*dim_/2+dim_/2+top_-2);
+                ro->panel_->setPosition(-sin(phi)*radius/
+                    3.5*dim_/2+dim_/2+left_-2,-cos(phi)*radius/3.5*dim_/2+dim_/2+top_-2);
             }
             ro = ro->next;
@@ -128,19 +119,19 @@
 	}
 
-	float RadarOverlayElement::calcRadius(RadarObject* obj){
-	    return(acos((currentDir_.dotProduct(obj->pos_ - shipPos_))/
-			((obj->pos_ - shipPos_).length()*currentDir_.length())));
+	float RadarOverlayElement::calcRadius(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
+	    return(acos((dir.dotProduct(obj->pos_ - pos))/
+			((obj->pos_ - pos).length()*dir.length())));
 	}
 
-	float RadarOverlayElement::calcPhi(RadarObject* obj){
+	float RadarOverlayElement::calcPhi(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
 	    // project difference vector on our plane...
-	    Vector3 proj = plane.projectVector(obj->pos_ - shipPos_);
+	    Vector3 proj = Plane(dir, pos).projectVector(obj->pos_ - pos);
 	    // ...and find out the angle
-	    return(acos((currentOrth_.dotProduct(proj))/
-            (currentOrth_.length()*proj.length())));
+	    return(acos((orth.dotProduct(proj))/
+            (orth.length()*proj.length())));
 	}
 
-	bool RadarOverlayElement::calcRight(RadarObject* obj){
-	    if((currentDir_.crossProduct(currentOrth_)).dotProduct(obj->pos_ - shipPos_) > 0)
+	bool RadarOverlayElement::calcRight(Vector3 pos, Vector3 dir, Vector3 orth, RadarObject* obj){
+	    if((dir.crossProduct(orth)).dotProduct(obj->pos_ - pos) > 0)
         	return true;
         else return false;
Index: /code/trunk/src/orxonox/hud/RadarOverlayElement.h
===================================================================
--- /code/trunk/src/orxonox/hud/RadarOverlayElement.h	(revision 1399)
+++ /code/trunk/src/orxonox/hud/RadarOverlayElement.h	(revision 1400)
@@ -41,10 +41,7 @@
             Ogre::OverlayManager* om;               // our one and only overlay manager
             Ogre::OverlayContainer* container_;     // pointer to the container we're in
-            Vector3 initialDir_;	                // direction of nose
             Vector3 currentDir_;
-            Vector3 initialOrth_;                   // direction of normal
             Vector3 currentOrth_;
             Vector3 shipPos_;                       // position of ship
-            Ogre::Plane plane;                      // plane perpendicular to dir
 
             Ogre::Real leftRel_, topRel_, dimRel_;  // relative position/dimension
@@ -59,7 +56,8 @@
             void update();
             void listObjects();
-            float calcRadius(RadarObject* obj);
-            float calcPhi(RadarObject* obj);
-            bool calcRight(RadarObject* obj);
+
+            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);
 	};
 }
Index: /code/trunk/src/orxonox/objects/SpaceShip.cc
===================================================================
--- /code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1399)
+++ /code/trunk/src/orxonox/objects/SpaceShip.cc	(revision 1400)
@@ -112,4 +112,8 @@
         this->setConfigValues();
 
+        initialDir_ = Vector3(1.0, 0.0, 0.0);
+        currentDir_ = initialDir_;
+        initialOrth_ = Vector3(0.0, 0.0, 1.0);
+        currentOrth_ = initialOrth_;
 
         this->setRotationAxis(1, 0, 0);
@@ -247,5 +251,5 @@
       this->camNode_ = this->getNode()->createChildSceneNode(camName_);
       COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl;
-      this->camNode_->setPosition(Vector3(-50,0,10));
+      this->camNode_->setPosition(Vector3(0,0,0));//-50,0,10));
 //      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
 //      Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,0,-1));
@@ -395,10 +399,10 @@
     }
 
-    Vector3 SpaceShip::getSPosition() {
-	return SpaceShip::getLocalShip()->getPosition();
-    }
-
-    Quaternion SpaceShip::getSOrientation() {
-	return SpaceShip::getLocalShip()->getOrientation();
+    Vector3 SpaceShip::getDir() {
+        return currentDir_;
+    }
+
+    Vector3 SpaceShip::getOrth(){
+        return currentOrth_;
     }
 
@@ -407,4 +411,7 @@
     void SpaceShip::tick(float dt)
     {
+        currentDir_ = getOrientation()*initialDir_;
+		currentOrth_ = getOrientation()*initialOrth_;
+
         if (this->cam_)
             this->cam_->tick(dt);
Index: /code/trunk/src/orxonox/objects/SpaceShip.h
===================================================================
--- /code/trunk/src/orxonox/objects/SpaceShip.h	(revision 1399)
+++ /code/trunk/src/orxonox/objects/SpaceShip.h	(revision 1400)
@@ -64,10 +64,7 @@
             void setTransDamp(float value);
             void setRotDamp(float value);
+            void getFocus();
 
-            void getFocus();
-            Camera* getCamera();
             static SpaceShip* instance_s;
-            static Vector3 getSPosition();
-            static Quaternion getSOrientation();
             static std::string whereAmI();
             static void setMaxSpeedTest(float value)
@@ -81,4 +78,7 @@
 
             float getMaxSpeed();
+            Vector3 getDir();
+            Vector3 getOrth();
+            Camera* getCamera();
 
         private:
@@ -86,4 +86,8 @@
 
             Vector3 testvector_;
+            Vector3 initialDir_;
+            Vector3 currentDir_;
+            Vector3 initialOrth_;
+            Vector3 currentOrth_;
             bool bInvertYAxis_;
             bool setMouseEventCallback_;
