Index: code/branches/presentationHS13/src/libraries/util/Math.cc
===================================================================
--- code/branches/presentationHS13/src/libraries/util/Math.cc	(revision 9900)
+++ code/branches/presentationHS13/src/libraries/util/Math.cc	(revision 9904)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Wolfgang Roenninger
  *
  */
@@ -147,5 +147,5 @@
 
     /**
-        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1).
+        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0� = 0, 180� = 1).
         @param myposition My position
         @param mydirection My viewing direction
@@ -189,4 +189,152 @@
         else
             return orxonox::Vector2( -sin_value * radius, cos_value * radius);
+    }
+
+
+    /**
+            @brief Gets the 2D project vector for the 3D Radar .
+            @param myposition My position
+            @param mydirection My viewing direction
+            @param myorthonormal My orthonormalvector (pointing upwards through my head)
+            @param otherposition The position of the other object
+            @param mapangle The angle between line of sight on screen and the 3Dmap-x/z-plain in radian
+            @param detectionlimit The limit in which objects are shown on the map
+            @return The viewing direction
+    */
+    orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit)
+    {
+    	// Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right
+    	orxonox::Vector3 distance = otherposition - myposition;	// get vector from Ship to object
+
+    	// new coordinate system:	x_axsis:	mydirection		(points front)
+    	//							y_axsis:	myorthonormal	(points up)
+    	//							z_axsis:	myside			(points right)
+
+    	orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get 3. base vector
+
+    	distance = 4*distance / detectionlimit; // shrink vector on map
+    	if(distance.length() > 1.0f) // if object would wander outside of the map
+    	    	{
+    	    	distance = distance / distance.length();
+    	   		}
+
+    	// perform a coordinate transformation to get distance in relation of the position of the ship
+    	orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside);
+
+    	// calculate 2D vector on the map (with angle between x/z - plain and line of sight)
+    	float xcoordinate = distanceShip.z; // z; cause x direction on screen is to the right side
+    	float ycoordinate = distanceShip.x*sin(mapangle)+distanceShip.y*cos(mapangle);
+    	return orxonox::Vector2(xcoordinate , ycoordinate);
+    }
+
+    /**
+               @brief Gets if a object is over the x/z - plain on map
+               @param myposition My position
+               @param mydirection My viewing direction
+               @param myorthonormal My orthonormalvector (pointing upwards through my head)
+               @param otherposition The position of the other object
+               @param mapangle The angle you look on the 3Dmap in radian
+               @return If distancevector to the other object has a positive y-coordinate
+
+               Examples:
+                Returns true if object is over x/z - plain
+                Returns false if object is below x/z -plain
+    */
+    bool isObjectHigherThanShipOnMap(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle)
+    {
+    	// Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right
+    	orxonox::Vector3 distance = otherposition - myposition;
+
+    	// new coordinate system:	x_axsis:	mydirection		(points front)
+    	//							y_axsis:	myorthonormal	(points up)
+       	//							z_axsis:	myside			(points right)
+
+       	orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get vector from Ship to object
+
+
+       	// perform a coordinate transformation to get distance in relation of the position of the ship
+       	orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside);
+
+       	if(distanceShip.y >= 0)
+       		return true;
+       	else
+       		return false;
+    }
+
+    /**
+                   @brief A value between 0 and 10, in order how other object is in front or in back
+                   @param myposition My position
+               	   @param mydirection My viewing direction
+               	   @param myorthonormal My orthonormalvector (pointing upwards through my head)
+               	   @param otherposition The position of the other object
+               	   @param detectionlimit The limit in which objects are shown on the map
+                   @return value between 0 and 100
+    */
+    int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit)
+    {
+    	orxonox::Vector3 distance = otherposition - myposition;	// get vector from Ship to object
+    	orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); 	// get vector to the side
+
+    	distance = 4*distance / detectionlimit; // shrink vector on map
+    	if(distance.length() > 1.0f) // if object would wander outside of the map
+    	{
+    		distance = distance / distance.length();
+    	}
+
+    	// perform a coordinate transformation to get distance in relation of the position of the ship
+       	orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside);
+
+       	return (int) 50 - 100*distanceShip.x;
+    }
+
+
+    /**
+                @brief Gets the new vector after a coordinate transformation
+                @param distance Vector which will be transformed
+                @param mydirection New x basevector
+                @param myorthonormal New y basevector
+                @param otherposition New z basevector
+                @return direction in the new coordinates
+
+                x is vector in old coordinates
+                y is vector in old coordinates
+                T is transform matrix with:
+                	T = (t1 , t2 , t3)
+                	t1 = mydirection
+                	t2 = myorthonormal
+                	t3 = myside
+
+                y = T^(-1)*x
+            */
+    orxonox::Vector3 getTransformedVector(const orxonox::Vector3& distance, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& myside)
+    {
+    	// inverse of the transform matrix
+    	float determinant = +mydirection.x * (myorthonormal.y*myside.z - myside.y*myorthonormal.z)
+    						-mydirection.y * (myorthonormal.x*myside.z - myorthonormal.z*myside.x)
+    						+mydirection.z * (myorthonormal.x*myside.y - myorthonormal.y*myside.x);
+    	float invdet = 1/determinant;
+
+    	// transform matrix
+    	orxonox::Vector3 xinvtransform;
+    	orxonox::Vector3 yinvtransform;
+    	orxonox::Vector3 zinvtransform;
+
+    	xinvtransform.x = (myorthonormal.y * myside.z        - myside.y        * myorthonormal.z)*invdet;
+    	xinvtransform.y = (mydirection.z   * myside.y        - mydirection.y   * myside.z       )*invdet;
+    	xinvtransform.z = (mydirection.y   * myorthonormal.z - mydirection.z   * myorthonormal.y)*invdet;
+    	yinvtransform.x = (myorthonormal.z * myside.x        - myorthonormal.x * myside.z       )*invdet;
+    	yinvtransform.y = (mydirection.x   * myside.z        - mydirection.z   * myside.x       )*invdet;
+    	yinvtransform.z = (myorthonormal.x * mydirection.z   - mydirection.x   * myorthonormal.z)*invdet;
+    	zinvtransform.x = (myorthonormal.x * myside.y        - myside.x        * myorthonormal.y)*invdet;
+    	zinvtransform.y = (myside.x        * mydirection.y   - mydirection.x   * myside.y       )*invdet;
+    	zinvtransform.z = (mydirection.x   * myorthonormal.y - myorthonormal.x * mydirection.y  )*invdet;
+
+    	// coordinate transformation
+    	orxonox::Vector3 distanceShip;
+    	distanceShip.x = xinvtransform.x * distance.x + yinvtransform.x * distance.y + zinvtransform.x * distance.z;
+    	distanceShip.y = xinvtransform.y * distance.x + yinvtransform.y * distance.y + zinvtransform.y * distance.z;
+    	distanceShip.z = xinvtransform.z * distance.x + yinvtransform.z * distance.y + zinvtransform.z * distance.z;
+
+    	return distanceShip;
     }
 
Index: code/branches/presentationHS13/src/libraries/util/Math.h
===================================================================
--- code/branches/presentationHS13/src/libraries/util/Math.h	(revision 9900)
+++ code/branches/presentationHS13/src/libraries/util/Math.h	(revision 9904)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Wolfgang Roenninger
  *
  */
@@ -92,4 +92,8 @@
     _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);
+    _UtilExport orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit);
+    _UtilExport bool isObjectHigherThanShipOnMap(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle);
+    _UtilExport int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit);
+    _UtilExport orxonox::Vector3 getTransformedVector(const orxonox::Vector3& distance, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& myside);
     _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity);
 
Index: code/branches/presentationHS13/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/presentationHS13/src/modules/overlays/hud/HUDNavigation.cc	(revision 9900)
+++ code/branches/presentationHS13/src/modules/overlays/hud/HUDNavigation.cc	(revision 9904)
@@ -74,6 +74,6 @@
         OrxonoxOverlay(context)
     {
-        RegisterObject(HUDNavigation)
-;        this->setConfigValues();
+        RegisterObject(HUDNavigation);
+        this->setConfigValues();
 
         // Set default values
Index: code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.cc
===================================================================
--- code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.cc	(revision 9900)
+++ code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.cc	(revision 9904)
@@ -25,4 +25,5 @@
  *   Co-authors:
  *      Reto Grieder
+ *      Wolfgang Roenninger
  *
  */
@@ -41,4 +42,5 @@
 #include "Scene.h"
 #include "Radar.h"
+#include "core/config/ConfigValueIncludes.h"
 
 namespace orxonox
@@ -50,4 +52,5 @@
     {
         RegisterObject(HUDRadar);
+        this->setConfigValues();
 
         this->marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
@@ -60,10 +63,23 @@
         this->setHalfDotSizeDistance(3000.0f);
         this->setMaximumDotSize(0.1f);
+        this->setMaximumDotSize3D(0.07f);
 
         this->shapeMaterials_[RadarViewable::Dot]      = "RadarDot.png";
         this->shapeMaterials_[RadarViewable::Triangle] = "RadarTriangle.png";
         this->shapeMaterials_[RadarViewable::Square]   = "RadarSquare.png";
-        this->setDetectionLimit( 10000.0f );
         this->owner_ = 0;
+
+        this->map3DFront_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+        	.createOverlayElement("Panel", "HUDRadar_mapDreiDFront_" + getUniqueNumberString()));
+        this->map3DFront_->setMaterialName("Orxonox/Radar3DFront");
+        this->overlay_->add2D(this->map3DFront_);
+        this->map3DFront_->hide();
+
+        this->map3DBack_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
+        	.createOverlayElement("Panel", "HUDRadar_mapDreiDBack_" + getUniqueNumberString()));
+        this->map3DBack_->setMaterialName("Orxonox/Radar3DBack");
+        this->overlay_->add2D(this->map3DBack_);
+        this->map3DBack_->hide();
+
     }
 
@@ -73,4 +89,7 @@
         {
             Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->marker_);
+            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DFront_);
+            Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DBack_);
+
             for (std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it = this->radarObjects_.begin();
                 it != this->radarObjects_.end(); ++it)
@@ -80,4 +99,11 @@
         }
     }
+
+
+
+    void HUDRadar::setConfigValues()
+       {
+           SetConfigValue(RadarMode_, true);
+       }
 
     void HUDRadar::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -88,4 +114,11 @@
         XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlelement, mode);
         XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlelement, mode);
+        XMLPortParam(HUDRadar, "maximumDotSize3D", setMaximumDotSize3D, getMaximumDotSize3D, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material2D", set2DMaterial, get2DMaterial, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material3DMiddle", set3DMaterial, get3DMaterial, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material3DFront", set3DMaterialFront, get3DMaterialFront, xmlelement, mode);
+        XMLPortParam(HUDRadar, "material3DBack", set3DMaterialBack, get3DMaterialBack, xmlelement, mode);
+        XMLPortParam(HUDRadar, "mapAngle3D", setMapAngle, getMapAngle, xmlelement, mode);
+        XMLPortParam(HUDRadar, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode);
     }
 
@@ -152,4 +185,21 @@
         // update the distances for all objects
         std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it;
+
+
+        if(RadarMode_)
+        {
+        	this->setBackgroundMaterial(material3D_);
+        	this->map3DFront_->_notifyZOrder(this->overlay_->getZOrder() * 100 + 250); // it seems that the ZOrder of overlayelements is 100 times the ZOrder of the overlay
+        	this->map3DBack_->_notifyZOrder(this->overlay_->getZOrder() * 100 - 250); // 250 a little bit buffer so that the two shels are displayed all in the front / in the back
+        	this->map3DFront_->show();
+        	this->map3DBack_->show();
+        }
+        else
+        {
+        	this->setBackgroundMaterial(material2D_);
+        	this->map3DFront_->hide();
+        	this->map3DBack_->hide();
+        }
+
         for( it = this->radarObjects_.begin(); it != this->radarObjects_.end(); ++it )
         {
@@ -165,11 +215,34 @@
             float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length();
             // calculate the size with 1/distance dependency for simplicity (instead of exp(-distance * lambda)
-            float size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
+
+            float size;
+            if(RadarMode_)
+            	size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
+            else
+            	size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();
             it->second->setDimensions(size, size);
 
             // calc position on radar...
-            Vector2 coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
+            Vector2 coord;
+
+            if(RadarMode_)
+            {
+            	coord = get3DProjection(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), 0.6435011, detectionLimit_);
+
+            	// set zOrder on screen
+            	bool overXZPlain = isObjectHigherThanShipOnMap(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), this->mapAngle_);
+
+            	int zOrder = determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_);
+            	if(overXZPlain == false /*&& (it->second->getZOrder() >  100 * this->overlay_->getZOrder())*/) // it appears that zOrder of attached Overlayelements is 100 times the zOrder of the Overlay
+            		it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder);
+            	if(overXZPlain == true /*&& (it->second->getZOrder() <= 100 * this->overlay_->getZOrder())*/)
+            		it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder);
+            }
+            else
+            	coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
+
             coord *= math::pi / 3.5f; // small adjustment to make it fit the texture
             it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f);
+
             if( distance < detectionLimit_ || detectionLimit_ < 0 )
                 it->second->show();
@@ -182,4 +255,6 @@
                 this->marker_->setDimensions(size * 1.5f, size * 1.5f);
                 this->marker_->setPosition((1.0f + coord.x - size * 1.5f) * 0.5f, (1.0f - coord.y - size * 1.5f) * 0.5f);
+                if(RadarMode_)
+                	this->marker_->_notifyZOrder(it->second->getZOrder() -1);
                 this->marker_->show();
             }
Index: code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.h
===================================================================
--- code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.h	(revision 9900)
+++ code/branches/presentationHS13/src/modules/overlays/hud/HUDRadar.h	(revision 9904)
@@ -35,4 +35,5 @@
 #include <map>
 #include <vector>
+#include <string>
 
 #include "util/OgreForwardRefs.h"
@@ -51,4 +52,5 @@
         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
         virtual void changedOwner();
+        void setConfigValues();
 
     private:
@@ -57,15 +59,32 @@
         void setHalfDotSizeDistance(float distance) { this->halfDotSizeDistance_ = distance; }
 
-        void setDetectionLimit( float limit )
-        { this->detectionLimit_ = limit; }
-        float getDetectionLimit() const
-        { return this->detectionLimit_; }
+        void setDetectionLimit( float limit ) { this->detectionLimit_ = limit; }
+        float getDetectionLimit() const { return this->detectionLimit_; }
 
         float getMaximumDotSize() const { return this->maximumDotSize_; }
         void setMaximumDotSize(float size) { this->maximumDotSize_ = size; }
 
+        float getMaximumDotSize3D() const { return this->maximumDotSize3D_; }
+        void setMaximumDotSize3D(float size) { this->maximumDotSize3D_ = size;}
+
+        std::string get2DMaterial() const {return this->material2D_; }
+        void set2DMaterial(std::string material2D) { this->material2D_ = material2D; }
+
+        std::string get3DMaterial() const {return this->material3D_; }
+        void set3DMaterial(std::string material3D) { this->material3D_ = material3D; }
+
+        std::string get3DMaterialFront() const {return this->material3DFront_; }
+        void set3DMaterialFront(std::string material3DFront) { this->material3DFront_ = material3DFront; }
+
+        std::string get3DMaterialBack() const {return this->material3DBack_; }
+        void set3DMaterialBack(std::string material3DBack) { this->material3DBack_ = material3DBack; }
+
         float getRadarSensitivity() const { return this->sensitivity_; }
         // used also by RadarListener interface!
         void setRadarSensitivity(float sensitivity) { this->sensitivity_ = sensitivity; }
+
+        // Determines angle between line of sight and x/z-plain on the 3D minimap
+        float getMapAngle() const { return this->mapAngle_; }
+        void setMapAngle(float mapAngle) { this->mapAngle_ = mapAngle; }
 
         // RadarListener interface
@@ -85,6 +104,18 @@
         Ogre::PanelOverlayElement* marker_;
 
+        bool RadarMode_; // Determines, if Radar runs in 3D or 2D Mode
+
         float halfDotSizeDistance_;
         float maximumDotSize_;
+        float maximumDotSize3D_;
+        float mapAngle_;
+
+        std::string material2D_;		//Material name for 2D map
+        std::string material3D_;		//Material names For the 3D minimap
+        std::string material3DFront_;
+        std::string material3DBack_;
+
+        Ogre::PanelOverlayElement* map3DFront_; //Overlayelements for the 3D minimap to be able to draw the points in a semi 3D matter
+        Ogre::PanelOverlayElement* map3DBack_;
 
         float sensitivity_;
