Index: /code/branches/presentation/data/levels/myTestLevel.oxw
===================================================================
--- /code/branches/presentation/data/levels/myTestLevel.oxw	(revision 8613)
+++ /code/branches/presentation/data/levels/myTestLevel.oxw	(revision 8614)
@@ -30,7 +30,9 @@
 
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
-    <SpawnPoint team=0 position="0,0,0" lookat="2,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+    <SpawnPoint team=0 position="0,0,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
     
-    <SpaceBoundaries warnDistance="1" maxDistance="200" showDistance="100" healthDecrease="0.1" position="0,0,0"/>
+    <SpaceBoundaries warnDistance="1" maxDistance="200" showDistance="100" reactionMode="0" healthDecrease="0.9" position="0,0,0"/>
+    
+    <Billboard position="0,0,0" colour="1.0,1.0,1.0" material="Flares/backlightflare" scale=1 />
     
   </Scene>
Index: /code/branches/presentation/src/orxonox/graphics/Billboard.cc
===================================================================
--- /code/branches/presentation/src/orxonox/graphics/Billboard.cc	(revision 8613)
+++ /code/branches/presentation/src/orxonox/graphics/Billboard.cc	(revision 8614)
@@ -23,4 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
+ *      Maurus Kaufmann
  *      ...
  *
@@ -30,5 +31,4 @@
 
 #include "OgreBillboard.h"
-#include "OgreBillboardSet.h"
 
 #include "core/CoreIncludes.h"
@@ -46,5 +46,5 @@
 
         this->colour_ = ColourValue::White;
-        //this->rotation_ = 0;
+        this->rotation_ = 0;
 
         this->registerVariables();
@@ -66,5 +66,5 @@
         XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode);
         XMLPortParam(Billboard, "colour",   setColour,   getColour,   xmlelement, mode).defaultValues(ColourValue::White);
-        //XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
+        XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
     }
 
@@ -73,5 +73,5 @@
         registerVariable(this->material_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
         registerVariable(this->colour_,   VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
-        //registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
+        registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
     }
 
@@ -89,5 +89,5 @@
                      this->attachOgreObject(this->billboard_.getBillboardSet());
                 this->billboard_.setVisible(this->isVisible());
-                //this->changedRotation();
+                this->changedRotation();
             }
         }
@@ -114,5 +114,5 @@
     }
 
-/*
+
     void Billboard::changedRotation()
     {
@@ -128,5 +128,5 @@
         }
     }
-*/
+
 
     void Billboard::changedVisibility()
@@ -136,3 +136,39 @@
         this->billboard_.setVisible(this->isVisible());
     }
+    
+    void Billboard::setBillboardType(Ogre::BillboardType bbt)
+    {
+        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+        if( bSet != NULL )
+        {
+            bSet->setBillboardType(bbt);
+        }
+    }
+    
+    void Billboard::setCommonDirection(Vector3 vec)
+    {
+        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+        if( bSet != NULL )
+        {
+            bSet->setCommonDirection( vec );
+        }
+    }
+            
+    void Billboard::setCommonUpVector(Vector3 vec)
+    {
+        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+        if( bSet != NULL )
+        {
+            bSet->setCommonUpVector( vec );
+        }
+    }
+    
+    void Billboard::setDefaultDimensions(float width, float height)
+    {
+        Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+        if( bSet != NULL )
+        {
+            bSet->setDefaultDimensions(width, height);
+        }
+    }
 }
Index: /code/branches/presentation/src/orxonox/graphics/Billboard.h
===================================================================
--- /code/branches/presentation/src/orxonox/graphics/Billboard.h	(revision 8613)
+++ /code/branches/presentation/src/orxonox/graphics/Billboard.h	(revision 8614)
@@ -23,4 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
+ *      Maurus Kaufmann
  *      ...
  *
@@ -31,4 +32,6 @@
 
 #include "OrxonoxPrereqs.h"
+
+#include "OgreBillboardSet.h"
 
 #include "util/Math.h"
@@ -62,13 +65,22 @@
                 { return this->colour_; }
 
-/*
+
             inline void setRotation(const Radian& rotation)
                 { this->rotation_ = rotation; this->changedRotation(); }
             inline const Radian& getRotation() const
                 { return this->rotation_; }
-*/
+
 
             virtual void setTeamColour(const ColourValue& colour)
                 { this->setColour(colour); }
+                
+            void setBillboardType(Ogre::BillboardType bbt);
+            
+            void setCommonDirection(Vector3 vec); //!< normalised Vector vec as argument
+            
+            void setCommonUpVector(Vector3 vec); //!< normalised Vector vec as argument
+            
+            void setDefaultDimensions(float width, float height);
+
 
         protected:
@@ -81,10 +93,10 @@
             void registerVariables();
             void changedMaterial();
-            //void changedRotation();
+            void changedRotation();
 
             BillboardSet billboard_;
             std::string material_;
             ColourValue colour_;
-            //Radian rotation_;
+            Radian rotation_;
     };
 }
Index: /code/branches/presentation/src/orxonox/worldentities/SpaceBoundaries.cc
===================================================================
--- /code/branches/presentation/src/orxonox/worldentities/SpaceBoundaries.cc	(revision 8613)
+++ /code/branches/presentation/src/orxonox/worldentities/SpaceBoundaries.cc	(revision 8614)
@@ -37,4 +37,6 @@
 #include "interfaces/RadarViewable.h"
 #include "graphics/Billboard.h"
+#include <OgreBillboardSet.h>
+
 
 namespace orxonox
@@ -44,18 +46,10 @@
     SpaceBoundaries::SpaceBoundaries(BaseObject* creator) : StaticEntity(creator)
     {
-        /* Standardwerte, die zum Tragen kommen,
-         * falls im XML-File keine Werte spezifiziert wurden. */
+        RegisterObject(SpaceBoundaries);
+
         this->setMaxDistance(3000);
-        this->setWarnDistance(2000);
-        this->setShowDistance(2500);
-        this->setHealthDecrease(1);
+        this->setWarnDistance(this->getMaxDistance());
+        this->setShowDistance(this->getMaxDistance());
         this->setReaction(0);
-        
-        RegisterObject(SpaceBoundaries);
-        
-        // Show Boundaries on the radar.
-        this->centerRadar_ = new RadarViewable(this, this);
-        this->centerRadar_->setRadarObjectShape(RadarViewable::Dot);
-        this->centerRadar_->setRadarVisibility(false);
     }
     SpaceBoundaries::~SpaceBoundaries()
@@ -63,6 +57,4 @@
         if (this->isInitialized())
         {
-            delete this->centerRadar_;
-        
             this->pawnsIn_.clear();
         
@@ -84,7 +76,18 @@
         {
             Pawn* currentPawn = *current;
-            float distance = this->computeDistance(currentPawn);
-            if(distance <= this->maxDistance_)
-            {
+            if( this->reaction_ == 0 )
+            {
+                float distance = this->computeDistance(currentPawn);
+                if(distance <= this->maxDistance_)
+                {
+                    pawnsIn_.push_back(currentPawn);
+                }
+            } else if (this->reaction_ == 2) {
+                float distance = this->computeDistance(currentPawn);
+                if(distance >= this->maxDistance_)
+                {
+                    pawnsIn_.push_back(currentPawn);
+                }
+            } else {
                 pawnsIn_.push_back(currentPawn);
             }
@@ -105,13 +108,18 @@
         {
             Billboard *tmp = new Billboard(this);
+            tmp->setPosition(position);
             this->setBillboardOptions( tmp );
-            tmp->setPosition(position);
+            Vector3 normalisedVec = (position - this->getPosition()).normalisedCopy(); /* Vektor von Kugelmitte nach aussen */
+            tmp->setCommonDirection ( -1.0 * normalisedVec );
+            tmp->setCommonUpVector( Vector3::UNIT_Z );
             billboardAdministration tmp2 = { true, tmp };
             this->billboards_.push_back( tmp2 );
-            
         } else {
             current->billy->setPosition(position);
             current->billy->setVisible(true);
             current->usedYet = true;
+            Vector3 normalisedVec = (position - this->getPosition()).normalisedCopy(); /* Vektor von Kugelmitte nach aussen */
+            current->billy->setCommonDirection ( -1.0 * normalisedVec );
+            current->billy->setCommonUpVector( Vector3::UNIT_Z );
         }
     }
@@ -121,5 +129,7 @@
         if(billy != NULL)
         {
-            billy->setMaterial("Shield");
+            billy->setMaterial("Grid");
+            billy->setBillboardType(Ogre::BBT_PERPENDICULAR_COMMON);
+            billy->setDefaultDimensions(150, 150);
             billy->setVisible(true);
         }
@@ -186,4 +196,5 @@
         XMLPortParam(SpaceBoundaries, "maxDistance", setMaxDistance, getMaxDistance, xmlelement, mode);
         XMLPortParam(SpaceBoundaries, "warnDistance", setWarnDistance, getWarnDistance, xmlelement, mode);
+        XMLPortParam(SpaceBoundaries, "showDistance", setShowDistance, getShowDistance, xmlelement, mode);
         XMLPortParam(SpaceBoundaries, "healthDecrease", setHealthDecrease, getHealthDecrease, xmlelement, mode);
         XMLPortParam(SpaceBoundaries, "reactionMode", setReaction, getReaction, xmlelement, mode);
@@ -194,5 +205,4 @@
         this->checkWhoIsIn();
         this->removeAllBillboards();
-        //COUT(0) << "Groesse der Liste: " << (int) pawnsIn_.size() << std::endl;
         
         float distance;
@@ -205,17 +215,15 @@
                 distance = this->computeDistance(currentPawn);
                 humanItem = this->isHumanPlayer(currentPawn);
-                //COUT(0) << "Distanz:" << distance << std::endl; // message for debugging
-                if(distance > this->warnDistance_ && distance < this->maxDistance_) // Zeige Warnung an!
-                {
-                    //COUT(0) << "You are near by the boundaries!" << std::endl; // message for debugging
+                COUT(5) << "Distance:" << distance << std::endl; // message for debugging
+                if(distance > this->warnDistance_ && distance < this->maxDistance_) // Display warning
+                {
                     if(humanItem)
                     {
-                        //COUT(0) << "humanItem ist true" << std::endl;
-                        this->displayWarning("Attention! You are near by the boundaries!");
+                        this->displayWarning("Attention! You are close to the boundary!");
                     }
                 }
-                if( (this->maxDistance_ - distance) < this->showDistance_ )
-                {
-                    this->displayBoundaries(currentPawn); // Zeige Grenze an!
+                if(/* humanItem &&*/ abs(this->maxDistance_ - distance) < this->showDistance_ )
+                {
+                    this->displayBoundaries(currentPawn); // Show the boundary
                 }
                 if(distance > this->maxDistance_ && (this->reaction_ == 1) )
@@ -223,10 +231,14 @@
                     if( humanItem )
                     {
-                        //COUT(0) << "Health should be decreasing!" << std::endl;
+                        COUT(5) << "Health should be decreasing!" << std::endl;
                         this->displayWarning("You are out of the area now!");
                     }
                     currentPawn->removeHealth( (distance - this->maxDistance_) * this->healthDecrease_);
                 }
-                if( (this->reaction_ == 0) && (distance + 100 > this->maxDistance_)) // Annahme: Ein Pawn kann von einem Tick bis zum nächsten nicht mehr als 100 Distanzeinheiten zurücklegen.
+                if( (this->reaction_ == 0) && (distance + 100 > this->maxDistance_)) // Exception: A Pawn can't move more than 100 units per tick.
+                {
+                    this->conditionalBounceBack(currentPawn, distance, dt);
+                }
+                if( this->reaction_ == 2 && (distance - 100 < this->maxDistance_) )
                 {
                     this->conditionalBounceBack(currentPawn, distance, dt);
@@ -249,5 +261,5 @@
     void SpaceBoundaries::displayWarning(const std::string warnText)
     {   
-        
+        // TODO
     }
     
@@ -270,18 +282,28 @@
         float normalSpeed = item->getVelocity().dotProduct(normal);
         
-        /* Checke, ob das Pawn innerhalb des nächsten Ticks, das erlaubte Gebiet verlassen würde.
-           Falls ja: Spicke es zurück. */
-        if( currentDistance + normalSpeed * dt > this->maxDistance_ )
-        {
-            float dampingFactor = 0.5;
-            velocity = velocity.reflect(normal);
-            Vector3 acceleration = item->getAcceleration();
-            acceleration = acceleration.reflect(normal);
-            
-            item->lookAt( velocity + this->getPosition() );
-            
-            item->setAcceleration(acceleration * dampingFactor);
-            item->setVelocity(velocity * dampingFactor);
-        }
+        /* Check, whether the Pawn would leave the boundary in the next tick, if so send it back. */
+        if( this->reaction_ == 0 && currentDistance + normalSpeed * dt > this->maxDistance_ - 10 ) // -10: "security measure"
+        {
+            bounceBack(item, &normal, &velocity);
+        } else if (this->reaction_ == 2 && currentDistance - normalSpeed * dt < this->maxDistance_ + 10 ) // 10: "security measure"
+        {
+            normal = normal * (-1);
+            bounceBack(item, &normal, &velocity);
+        }
+    }
+    
+    void SpaceBoundaries::bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity)
+    {
+        float dampingFactor = 0.5;
+        *velocity = velocity->reflect(*normal);
+        Vector3 acceleration = item->getAcceleration();
+        acceleration = acceleration.reflect(*normal);
+        
+        item->lookAt( *velocity + this->getPosition() );
+        
+        item->setAcceleration(acceleration * dampingFactor);
+        item->setVelocity(*velocity * dampingFactor);
+        
+        item->setPosition( item->getPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary.
     }
     
Index: /code/branches/presentation/src/orxonox/worldentities/SpaceBoundaries.h
===================================================================
--- /code/branches/presentation/src/orxonox/worldentities/SpaceBoundaries.h	(revision 8613)
+++ /code/branches/presentation/src/orxonox/worldentities/SpaceBoundaries.h	(revision 8614)
@@ -26,13 +26,4 @@
  *
  */
- 
- /* TODO:   - Textmessages und Billboards sollen teils nur bei einem humanPlayer angezeigt werden, nicht bei allen (vgl. Netzwerk-Spiel mit mehreren humanPlayers)
-                beachte hierzu folgende statische Funktion: 'static unsigned int  Host::getPlayerID()'
-                (file:///home/kmaurus/orxonox/spaceBoundaries/build/doc/api/html/classorxonox_1_1_host.html#9c1e3b39e3b42e467dfbf42902911ce2)
-                
-            - Kommentieren (Betrachte als Beispiel/Vorbild 'libraries/core/WeakPtr.h')
-            
-            - Wiki-SpaceBoundaries-Eintrag aktualisieren
- */
 
 #ifndef _SpaceBoundaries_H__
@@ -49,5 +40,4 @@
 #include <string>
 #include <list>
-#include <map>
 #include <vector>
 
@@ -58,14 +48,28 @@
 @brief SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area (until now this area is a ball).
 
-       Five attributes can/should be defined in the XML-File:
+       Some attributes can/should be defined in the XML-File:
+       - 'position' : absolute position of the object of SpaceBoundaries in the level (usually 0,0,0) 
+       - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
        - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to
-                          inform the player that he'll soon be leaving the allowed area. 
-       - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
+                          inform the player that he'll soon be leaving the allowed area. (not implemented yet!)
        - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown. 
-       - 'healthDecrease' : a measure to define how fast the health of a pawn should decrease after leaving the allowed area (unnecessary if 'reactionMode' == 0).
-                            Recommended values: 0.1 (slow health decrease) to 5 (very fast health decrease)
        - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
                             0: Reflect the space ship (default).
                             1: Decrease Health of the space ship after having left the allowed area.
+                            2: Inverted Version of 0. Prohibit to fly INTO a defined area.
+       - 'healthDecrease' : a measure to define how fast the health of a pawn should decrease after leaving the allowed area (unnecessary if 'reactionMode' == 0).
+                            Recommended values: 0.1 (slow health decrease) to 5 (very fast health decrease)
+
+Follow http://www.orxonox.net/wiki/SpaceBoundaries to get some further information.
+
+Examples:
+Two examples how one could include SpaceBoundaries in the XML-File. The first one uses reflection, the second one health decrease.
+@code
+<SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="0" />
+@endcode
+
+@code
+<SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="1" healthDecrease="0.2" />
+@endcode
 */
 
@@ -75,10 +79,4 @@
             SpaceBoundaries(BaseObject* creator);
             ~SpaceBoundaries();
-            
-            void checkWhoIsIn(); //!< Update the list 'pawnsIn_'.
-            
-            void positionBillboard(const Vector3 position); //!< Display a Billboard at the position 'position'.
-            void setBillboardOptions(Billboard *billy);
-            void removeAllBillboards(); //!< Hide all all elements of '*billboard_' and set their attribute 'usedYet' to 0.
             
             void setMaxDistance(float r);
@@ -104,23 +102,34 @@
             struct billboardAdministration{ bool usedYet; Billboard* billy; };
             
+            // Variabeln::
             std::list<WeakPtr<Pawn> > pawnsIn_; //!< List of the pawns that this instance of SpaceBoundaries has to handle.
             
             std::vector<billboardAdministration> billboards_;
         
-            int reaction_; //!< Werte: 0, 1. 0: Reflektion an Boundaries (Standard). 1: Health-Abzug-Modus.
-            float maxDistance_; //!< maximal zulaessige Entfernung von 'this->getPosition()'.
-            float warnDistance_; //!< Entfernung von 'this->getPosition()', ab der eine Warnung angezeigt wird, dass man bald das zulaessige Areal verlaesst.
-            float showDistance_; //!< Definiert, wann die Grenzen visualisiert werden sollen.
+            int reaction_; //!< Values: 0, 1, 2.
+                           //!< 0: Reflection on boundary (Standard).
+                           //!< 1: Decrease-Health-Mode.
+                           //!< 2: Inverted Version of 0. Prohibit to fly INTO a defined area.
+            float maxDistance_; //!<  Maximum allowed distance.
+            float warnDistance_; //!< Distance in which a warning is displayed.
+            float showDistance_; //!< Distance at which the boundaries are displayed.
             
-            float healthDecrease_; //!< Mass fuer die Anzahl Health-Points, die nach ueberschreiten der Entfernung 'maxDistance_' von 'this->getPosition()' abgezogen werden.
-                                   //!< Empfohlene Werte: 0.1 (langsame Health-Verminderung) bis 5 (sehr schnelle Health-Verminderung)
+            float healthDecrease_; //!< Rate of health loss.
             
-            RadarViewable* centerRadar_; //!< Repraesentation von SpaceBoundaries auf dem Radar.
+            //RadarViewable* centerRadar_; //!< Representation of the space boundary in the radar.
         
-            float computeDistance(WorldEntity *item); //!< Auf den Mittelpunkt 'this->getPosition()' bezogen.
-            void displayWarning(const std::string warnText);
+            // Funktionen::
+            float computeDistance(WorldEntity *item); //!< Compute distance to center point.
+            void displayWarning(const std::string warnText); //!< TODO: Implement.
             void displayBoundaries(Pawn *item);
             void conditionalBounceBack(Pawn *item, float currentDistance, float dt);
+            void bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity);
             bool isHumanPlayer(Pawn *item);
+            
+            void checkWhoIsIn(); //!< Update the list 'pawnsIn_'.
+            
+            void positionBillboard(const Vector3 position); //!< Display a Billboard at the position 'position'.
+            void setBillboardOptions(Billboard *billy);
+            void removeAllBillboards(); //!< Hide all elements of '*billboard_' and set their attribute 'usedYet' to 0.
             
     };
