Index: code/trunk/src/orxonox/objects/worldentities/Attacher.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Attacher.cc	(revision 3077)
+++ code/trunk/src/orxonox/objects/worldentities/Attacher.cc	(revision 3077)
@@ -0,0 +1,121 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "OrxonoxStableHeaders.h"
+#include "Attacher.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+    CreateFactory(Attacher);
+
+    Attacher::Attacher(BaseObject* creator) : StaticEntity(creator)
+    {
+        RegisterObject(Attacher);
+
+        this->target_ = 0;
+    }
+
+    void Attacher::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(Attacher, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Attacher, "target", setTarget, getTarget, xmlelement, mode);
+        XMLPortObject(Attacher, WorldEntity, "", addObject, getObject, xmlelement, mode);
+    }
+
+    void Attacher::processEvent(Event& event)
+    {
+        for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+            (*it)->fireEvent(event);
+    }
+
+    void Attacher::changedActivity()
+    {
+        SUPER(Attacher, changedActivity);
+
+        for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+            (*it)->setActive(this->isActive());
+    }
+
+    void Attacher::changedVisibility()
+    {
+        SUPER(Attacher, changedVisibility);
+
+        for (std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+            (*it)->setVisible(this->isVisible());
+    }
+
+    void Attacher::addObject(WorldEntity* object)
+    {
+        this->objects_.push_back(object);
+
+        this->attach(object);
+    }
+
+    WorldEntity* Attacher::getObject(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::list<WorldEntity*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+        {
+            if (i == index)
+                return (*it);
+
+            ++i;
+        }
+        return 0;
+    }
+
+    void Attacher::setTarget(const std::string& target)
+    {
+        this->targetname_ = target;
+        this->target_ = 0;
+
+        if (this->targetname_ == "")
+            return;
+
+        for (ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)
+            if (it->getName() == this->targetname_)
+                this->attachToParent(*it);
+    }
+
+    void Attacher::loadedNewXMLName(BaseObject* object)
+    {
+        if (this->target_ || this->targetname_ == "")
+            return;
+
+        WorldEntity* entity = dynamic_cast<WorldEntity*>(object);
+        if (entity && entity->getName() == this->targetname_)
+        {
+            this->target_ = entity;
+            this->attachToParent(entity);
+        }
+    }
+}
Index: code/trunk/src/orxonox/objects/worldentities/Attacher.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Attacher.h	(revision 3077)
+++ code/trunk/src/orxonox/objects/worldentities/Attacher.h	(revision 3077)
@@ -0,0 +1,69 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Attacher_H__
+#define _Attacher_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <list>
+
+#include "objects/worldentities/StaticEntity.h"
+#include "core/XMLNameListener.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport Attacher : public StaticEntity, public XMLNameListener
+    {
+        public:
+            Attacher(BaseObject* creator);
+            virtual ~Attacher() {}
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            virtual void processEvent(Event& event);
+            virtual void changedActivity();
+            virtual void changedVisibility();
+
+            void addObject(WorldEntity* object);
+            WorldEntity* getObject(unsigned int index) const;
+
+            void setTarget(const std::string& target);
+            inline const std::string& getTarget() const
+                { return this->targetname_; }
+
+            void loadedNewXMLName(BaseObject* object);
+
+        private:
+            WorldEntity* target_;
+            std::string targetname_;
+            std::list<WorldEntity*> objects_;
+    };
+}
+
+#endif /* _Attacher_H__ */
Index: code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 3076)
+++ code/trunk/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 3077)
@@ -6,4 +6,5 @@
   ControllableEntity.cc
 
+  Attacher.cc
   Backlight.cc
   Billboard.cc
Index: code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 3076)
+++ code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 3077)
@@ -69,4 +69,5 @@
         this->parent_ = 0;
         this->parentID_ = OBJECTID_UNKNOWN;
+        this->bDeleteWithParent_ = true;
 
         this->node_->setPosition(Vector3::ZERO);
@@ -108,5 +109,14 @@
 
             for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); )
-                delete (*(it++));
+            {
+                if ((*it)->getDeleteWithParent())
+                    delete (*(it++));
+                else
+                {
+                    this->detach(*it);
+                    (*it)->setPosition(this->getWorldPosition());
+                    ++it;
+                }
+            }
 
             if (this->physicalBody_)
@@ -138,4 +148,5 @@
         XMLPortParamLoadOnly(WorldEntity, "pitch",       pitch_xmlport,        xmlelement, mode);
         XMLPortParamLoadOnly(WorldEntity, "roll",        roll_xmlport,         xmlelement, mode);
+        XMLPortParam        (WorldEntity, "deletewithparent", setDeleteWithParent, getDeleteWithParent, xmlelement, mode);
 
         // Physics
Index: code/trunk/src/orxonox/objects/worldentities/WorldEntity.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/WorldEntity.h	(revision 3076)
+++ code/trunk/src/orxonox/objects/worldentities/WorldEntity.h	(revision 3077)
@@ -173,4 +173,9 @@
             void detachFromNode(Ogre::SceneNode* node);
 
+            inline void setDeleteWithParent(bool value)
+                { this->bDeleteWithParent_ = value; }
+            inline bool getDeleteWithParent() const
+                { return this->bDeleteWithParent_; }
+
             void notifyChildPropsChanged();
 
@@ -200,4 +205,5 @@
             unsigned int parentID_;
             std::set<WorldEntity*> children_;
+            bool bDeleteWithParent_;
 
 
