Index: code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.cc
===================================================================
--- code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.cc	(revision 2176)
+++ code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.cc	(revision 2182)
@@ -30,13 +30,11 @@
 #include "Backlight.h"
 
-#include <OgreBillboard.h>
 #include <OgreRibbonTrail.h>
 #include <OgreSceneManager.h>
 
+#include "core/Core.h"
 #include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/Executor.h"
-#include "util/Math.h"
-#include "GraphicsEngine.h"
+#include "core/XMLPort.h"
+#include "objects/Scene.h"
 
 namespace orxonox
@@ -44,4 +42,153 @@
     CreateFactory(Backlight);
 
+    Backlight::Backlight(BaseObject* creator) : Billboard(creator)
+    {
+        RegisterObject(Backlight);
+
+        this->ribbonTrail_ = 0;
+        this->ribbonTrailNode_ = 0;
+
+        this->width_ = 0;
+        this->length_ = 1.0f;
+        this->lifetime_ = 1.0f;
+        this->maxelements_ = 1;
+
+        if (Core::showsGraphics())
+        {
+            assert(this->getScene());
+            assert(this->getScene()->getSceneManager());
+            assert(this->getScene()->getRootSceneNode());
+
+            this->ribbonTrail_ = this->getScene()->getSceneManager()->createRibbonTrail(this->getNode()->getName());
+            this->ribbonTrailNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
+            this->ribbonTrailNode_->attachObject(this->ribbonTrail_);
+            this->ribbonTrail_->addNode(this->getNode());
+
+            this->ribbonTrail_->setMaxChainElements(this->maxelements_);
+            this->ribbonTrail_->setTrailLength(this->length_);
+            this->ribbonTrail_->setInitialWidth(0, this->width_);
+        }
+
+        this->registerVariables();
+    }
+
+    Backlight::~Backlight()
+    {
+        if (this->isInitialized())
+        {
+            if (this->ribbonTrail_)
+            {
+                if (this->ribbonTrailNode_)
+                {
+                    this->ribbonTrailNode_->detachObject(this->ribbonTrail_);
+                    this->getScene()->getSceneManager()->destroySceneNode(this->ribbonTrailNode_->getName());
+                }
+                this->getScene()->getSceneManager()->destroyRibbonTrail(this->ribbonTrail_);
+            }
+        }
+    }
+
+    void Backlight::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Backlight, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Backlight, "length",        setLength,        getLength,        xmlelement, mode).defaultValues(100.0f);
+        XMLPortParam(Backlight, "width",         setWidth,         getWidth,         xmlelement, mode).defaultValues(1.0f);
+        XMLPortParam(Backlight, "elements",      setMaxElements,   getMaxElements,   xmlelement, mode).defaultValues(10);
+        XMLPortParam(Backlight, "lifetime",      setLifetime,      getLifetime,      xmlelement, mode).defaultValues(1.0f);
+        XMLPortParam(Backlight, "trailmaterial", setTrailMaterial, getTrailMaterial, xmlelement, mode);
+    }
+
+    void Backlight::registerVariables()
+    {
+        REGISTERDATA  (this->width_,         direction::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_width));
+        REGISTERDATA  (this->lifetime_,      direction::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_lifetime));
+        REGISTERDATA  (this->length_,        direction::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_length));
+        REGISTERDATA  (this->maxelements_,   direction::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_maxelements));
+        REGISTERSTRING(this->trailmaterial_, direction::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_trailmaterial));
+    }
+
+    void Backlight::changedColour()
+    {
+        Billboard::changedColour();
+
+        if (this->ribbonTrail_ && this->isActive())
+            this->ribbonTrail_->setInitialColour(0, this->getColour());
+    }
+
+    void Backlight::update_width()
+    {
+        if (this->ribbonTrail_)
+            this->ribbonTrail_->setInitialWidth(0, this->width_);
+        this->update_lifetime();
+    }
+
+    void Backlight::update_lifetime()
+    {
+        if (this->ribbonTrail_)
+        {
+            this->ribbonTrail_->setWidthChange(0, this->width_ / this->lifetime_/* * Backlight::timeFactor_s*/);
+            this->ribbonTrail_->setColourChange(0, 0, 0, 0, 1.0f / this->lifetime_/* * Backlight::timeFactor_s*/);
+        }
+    }
+
+    void Backlight::update_length()
+    {
+//        if (this->ribbonTrail_)
+//            this->ribbonTrail_->setTrailLength(this->length_);
+    }
+
+    void Backlight::update_maxelements()
+    {
+        if (this->ribbonTrail_)
+            this->ribbonTrail_->setMaxChainElements(this->maxelements_);
+    }
+
+    void Backlight::update_trailmaterial()
+    {
+        if (this->ribbonTrail_)
+            this->ribbonTrail_->setMaterialName(this->trailmaterial_);
+    }
+
+    void Backlight::changedVisibility()
+    {
+        SUPER(Backlight, changedVisibility);
+
+        if (this->ribbonTrail_)
+            this->ribbonTrail_->setVisible(this->isVisible());
+    }
+
+    void Backlight::changedActivity()
+    {
+        SUPER(Backlight, changedActivity);
+
+        if (this->ribbonTrail_)
+        {
+            if (this->isActive())
+                this->ribbonTrail_->setInitialColour(0, this->getColour());
+            else
+                this->ribbonTrail_->setInitialColour(0, 0, 0, 0, 0);
+        }
+    }
+
+    void Backlight::notifyAttached()
+    {
+        Billboard::notifyAttached();
+
+//        if (this->ribbonTrail_)
+//            this->ribbonTrail_->clearChain(0);
+
+//        if (this->ribbonTrail_)
+//            this->ribbonTrail_->setTrailLength(this->length_);
+    }
+
+    void Backlight::tick(float dt)
+    {
+        if (this->ribbonTrail_)
+            this->ribbonTrail_->setTrailLength(this->length_);
+    }
+
+//------------------------------------------------------------------------------------
+/*
     float Backlight::timeFactor_s = 1.0;
 
@@ -52,12 +199,13 @@
         this->setConfigValues();
         this->traillength_ = 1;
+        this->colour_ = ColourValue::White;
 
         this->configure(maxspeed, brakingtime, scale);
     }
-    
+
     bool Backlight::create(){
       if(!WorldEntity::create())
         return false;
-      
+
       this->getNode()->setInheritScale(false);
 
@@ -76,5 +224,5 @@
         //this->setTimeFactor(Orxonox::getInstance().getTimeFactor());
       this->setTimeFactor(1.0f);
-      
+
       this->ribbonTrail_->setMaxChainElements(this->maxTrailsegments_);
       this->ribbonTrail_->setTrailLength(this->traillength_ = 2 * this->maxTrailsegments_);
@@ -113,11 +261,4 @@
         this->ribbonTrail_->setColourChange(0, ColourValue(0, 0, 0, this->maxTraillength_ / this->traillength_ / this->maxLifeTime_ * Backlight::timeFactor_s));
     }
-    
-    
-    void Backlight::XMLPort(Element& xmlelement, XMLPort::Mode mode){
-      SUPER(Backlight, XMLPort, xmlelement, mode);
-      
-      Backlight::create();
-    }
 
     void Backlight::tick(float dt)
@@ -145,10 +286,4 @@
     }
 
-    void Backlight::setColour(const ColourValue& colour)
-    {
-        this->billboard_.getBillboardSet()->getBillboard(0)->setColour(colour);
-        this->ribbonTrail_->setInitialColour(0, ColourValue(colour.r / 4 + 0.75, colour.g / 4 + 0.75, colour.b / 4 + 0.75));
-    }
-
     void Backlight::configure(float maxspeed, float brakingtime, float scale)
     {
@@ -168,3 +303,4 @@
         this->ribbonTrail_->setVisible(this->isVisible());
     }
+*/
 }
Index: code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.h
===================================================================
--- code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.h	(revision 2176)
+++ code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.h	(revision 2182)
@@ -31,12 +31,69 @@
 
 #include "OrxonoxPrereqs.h"
-
-#include "PositionableEntity.h"
-#include "tools/BillboardSet.h"
+#include "Billboard.h"
+#include "objects/Tickable.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Backlight : public PositionableEntity
+    class _OrxonoxExport Backlight : public Billboard, public Tickable
     {
+        public:
+            Backlight(BaseObject* creator);
+            virtual ~Backlight();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
+
+            virtual void tick(float dt);
+            virtual void changedActivity();
+            virtual void changedVisibility();
+
+            inline void setWidth(float width)
+                { this->width_ = width; this->update_width(); }
+            inline float getWidth() const
+                { return this->width_; }
+
+            inline void setLifetime(float lifetime)
+                { this->lifetime_ = lifetime; this->update_lifetime(); }
+            inline float getLifetime() const
+                { return this->lifetime_; }
+
+            inline void setLength(float length)
+                { this->length_ = length; this->update_length(); }
+            inline float getLength() const
+                { return this->length_; }
+
+            inline void setMaxElements(size_t maxelements)
+                { this->maxelements_ = maxelements; this->update_maxelements(); }
+            inline size_t getMaxElements() const
+                { return this->maxelements_; }
+
+            inline void setTrailMaterial(const std::string& material)
+                { this->trailmaterial_ = material; this->update_trailmaterial(); }
+            inline const std::string& getTrailMaterial() const
+                { return this->trailmaterial_; }
+
+        protected:
+            virtual void notifyAttached();
+
+        private:
+            virtual void changedColour();
+            void update_width();
+            void update_lifetime();
+            void update_length();
+            void update_maxelements();
+            void update_trailmaterial();
+
+            Ogre::RibbonTrail* ribbonTrail_;
+            Ogre::SceneNode* ribbonTrailNode_;
+            float width_;
+            float length_;
+            float lifetime_;
+            size_t maxelements_;
+            std::string trailmaterial_;
+    };
+
+
+/*
         public:
             Backlight(float maxspeed = 1.0, float brakingtime = 1.0, float scale = 1.0);
@@ -49,5 +106,5 @@
             virtual bool create();
 
-            void setColour(const ColourValue& colour);
+
             void setTimeFactor(float factor);
 
@@ -60,4 +117,5 @@
             Ogre::SceneNode* ribbonTrailNode_;
             Ogre::RibbonTrail* ribbonTrail_;
+
 
             float maxLifeTime_;
@@ -72,4 +130,5 @@
             size_t maxTrailsegments_;
     };
+*/
 }
 
Index: code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Billboard.cc
===================================================================
--- code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Billboard.cc	(revision 2176)
+++ code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Billboard.cc	(revision 2182)
@@ -41,4 +41,7 @@
     {
         RegisterObject(Billboard);
+
+        this->material_ = "";
+        this->colour_ = ColourValue::White;
 
         this->registerVariables();
@@ -88,5 +91,5 @@
         if (!this->billboard_.getBillboardSet())
         {
-            if (this->getScene() && this->getScene()->getSceneManager())
+            if (this->getScene() && this->getScene()->getSceneManager() && (this->material_ != ""))
             {
                 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1);
Index: code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Billboard.h
===================================================================
--- code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Billboard.h	(revision 2176)
+++ code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Billboard.h	(revision 2182)
@@ -61,7 +61,9 @@
                 { return this->colour_; }
 
+        protected:
+            virtual void changedColour();
+
         private:
             void changedMaterial();
-            void changedColour();
 
             BillboardSet billboard_;
Index: code/branches/objecthierarchy2/src/orxonox/objects/worldentities/CMakeLists.txt
===================================================================
--- code/branches/objecthierarchy2/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 2176)
+++ code/branches/objecthierarchy2/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 2182)
@@ -4,5 +4,6 @@
   MovableEntity.cc
   ControllableEntity.cc
-  Model.cc
+
+  Backlight.cc
   Billboard.cc
   BlinkingBillboard.cc
@@ -10,8 +11,8 @@
   Camera.cc
   CameraPosition.cc
-  SpawnPoint.cc
+  Model.cc
   ParticleEmitter.cc
   ParticleSpawner.cc
-#  Backlight.cc
+  SpawnPoint.cc
 )
 
Index: code/branches/objecthierarchy2/src/orxonox/objects/worldentities/WorldEntity.cc
===================================================================
--- code/branches/objecthierarchy2/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2176)
+++ code/branches/objecthierarchy2/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2182)
@@ -131,4 +131,6 @@
         object->parent_ = this;
         object->parentID_ = this->getObjectID();
+
+        object->notifyAttached();
     }
 
Index: code/branches/objecthierarchy2/src/orxonox/objects/worldentities/WorldEntity.h
===================================================================
--- code/branches/objecthierarchy2/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2176)
+++ code/branches/objecthierarchy2/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2182)
@@ -139,4 +139,6 @@
 
         protected:
+            virtual void notifyAttached() {}
+
             Ogre::SceneNode* node_;
 
