Index: code/branches/physics/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/physics/src/orxonox/CMakeLists.txt	(revision 2302)
+++ code/branches/physics/src/orxonox/CMakeLists.txt	(revision 2303)
@@ -71,4 +71,8 @@
 #  objects/worldentities/Backlight.cc
 
+  objects/worldentities/collisionshapes/CollisionShape.cc
+  objects/worldentities/collisionshapes/CompoundCollisionShape.cc
+  objects/worldentities/collisionshapes/SphereCollisionShape.cc
+  
   objects/quest/AddQuest.cc
   objects/quest/AddQuestHint.cc
Index: code/branches/physics/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/physics/src/orxonox/OrxonoxPrereqs.h	(revision 2302)
+++ code/branches/physics/src/orxonox/OrxonoxPrereqs.h	(revision 2303)
@@ -151,4 +151,8 @@
     class Scores;
 
+    // collision
+    class CollisionShape;
+    class SphereCollisionShape;
+
     // tools
     class BillboardSet;
@@ -209,8 +213,12 @@
 class btCollisionObject;
 class btGhostObject;
+
 class btCollisionShape;
 class btSphereShape;
-
-
+class btCompoundShape;
+
+class btDiscreteDynamicsWorld;
+
+// lua
 struct lua_State;
 
Index: code/branches/physics/src/orxonox/objects/Scene.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/Scene.cc	(revision 2302)
+++ code/branches/physics/src/orxonox/objects/Scene.cc	(revision 2303)
@@ -35,11 +35,13 @@
 #include <OgreLight.h>
 
+#include "BulletCollision/BroadphaseCollision/btAxisSweep3.h"
+#include "BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h"
+#include "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h"
+#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
+
 #include "core/CoreIncludes.h"
 #include "core/Core.h"
 #include "core/XMLPort.h"
-
-#include "BulletCollision/BroadphaseCollision/btAxisSweep3.h"
-#include "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h"
-#include "BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h"
+#include "objects/worldentities/WorldEntity.h"
 
 namespace orxonox
@@ -123,4 +125,18 @@
 
         XMLPortObjectExtended(Scene, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
+
+        // finally add all rigid bodies to the physics engine
+        if (hasPhysics())
+        {
+            for (std::list<BaseObject*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)
+            {
+                WorldEntity* temp = dynamic_cast<WorldEntity*>(*it);
+                if (temp)
+                {
+                    if (temp->getCollisionType() != WorldEntity::None)
+                        this->physicalWorld_->addRigidBody(temp->getPhysicalBody());
+                }
+            }
+        }
     }
 
@@ -157,5 +173,5 @@
     {
         if (physicalWorld_)
-            physicalWorld_->stepSimulation(dt,10);
+            physicalWorld_->stepSimulation(dt,(int)(dt/0.0166666f));
     }
 
Index: code/branches/physics/src/orxonox/objects/Scene.h
===================================================================
--- code/branches/physics/src/orxonox/objects/Scene.h	(revision 2302)
+++ code/branches/physics/src/orxonox/objects/Scene.h	(revision 2303)
@@ -37,6 +37,4 @@
 #include "objects/Tickable.h"
 
-#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
-
 namespace orxonox
 {
@@ -70,8 +68,8 @@
                 { return this->bShadows_; }
 
-            inline const Vector3& getWorldAabbMax()
-            {
-                this->physicalWorld_->getBroadphase();
-            }
+            //inline const Vector3& getWorldAabbMax()
+            //{
+            //    this->physicalWorld_->getBroadphase();
+            //}
 
             inline bool hasPhysics()
Index: code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 2302)
+++ code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 2303)
@@ -30,4 +30,6 @@
 #include "MovableEntity.h"
 
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
 #include "util/Exception.h"
 #include "core/CoreIncludes.h"
@@ -61,103 +63,4 @@
     {
     }
-
-    //void MovableEntity::setPosition(const Vector3& position)
-    //{
-    //    //if (isDynamic() && bAddedToPhysicalWorld_)
-    //    //{
-    //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
-    //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
-    //    //}
-    //    this->node_->setPosition(position);
-    //    positionChanged();
-    //}
-
-    //void MovableEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)
-    //{
-    //    //if (isDynamic() && bAddedToPhysicalWorld_)
-    //    //{
-    //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
-    //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
-    //    //}
-    //    this->node_->translate(distance, relativeTo); 
-    //    positionChanged();
-    //}
-
-    //void MovableEntity::setOrientation(const Quaternion& orientation)
-    //{
-    //    //if (isDynamic() && bAddedToPhysicalWorld_)
-    //    //{
-    //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
-    //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
-    //    //}
-    //    this->node_->setOrientation(orientation);
-    //    orientationChanged();
-    //}
-
-    //void MovableEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)
-    //{
-    //    //if (isDynamic() && bAddedToPhysicalWorld_)
-    //    //{
-    //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
-    //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
-    //    //}
-    //    this->node_->rotate(rotation, relativeTo);
-    //    orientationChanged();
-    //}
-
-    //void MovableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
-    //{
-    //    //if (isDynamic() && bAddedToPhysicalWorld_)
-    //    //{
-    //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
-    //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
-    //    //}
-    //    this->node_->yaw(angle, relativeTo);
-    //    orientationChanged();
-    //}
-
-    //void MovableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
-    //{
-    //    //if (isDynamic() && bAddedToPhysicalWorld_)
-    //    //{
-    //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
-    //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
-    //    //}
-    //    this->node_->pitch(angle, relativeTo);
-    //    orientationChanged();
-    //}
-
-    //void MovableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
-    //{
-    //    //if (isDynamic() && bAddedToPhysicalWorld_)
-    //    //{
-    //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
-    //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
-    //    //}
-    //    this->node_->roll(angle, relativeTo);
-    //    orientationChanged();
-    //}
-
-    //void MovableEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
-    //{
-    //    //if (isDynamic() && bAddedToPhysicalWorld_)
-    //    //{
-    //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
-    //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
-    //    //}
-    //    this->node_->lookAt(target, relativeTo, localDirectionVector); 
-    //    orientationChanged();
-    //}
-
-    //void MovableEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
-    //{
-    //    //if (isDynamic() && bAddedToPhysicalWorld_)
-    //    //{
-    //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
-    //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
-    //    //}
-    //    this->node_->setDirection(direction, relativeTo, localDirectionVector); 
-    //    orientationChanged();
-    //}
 
     void MovableEntity::setPosition(const Vector3& position)
Index: code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.cc	(revision 2302)
+++ code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.cc	(revision 2303)
@@ -62,7 +62,7 @@
     bool StaticEntity::isCollisionTypeLegal(WorldEntity::CollisionType type) const
     {
-        if (type == WorldEntity::Static)
+        if (type == WorldEntity::Kinematic || type == WorldEntity::Dynamic)
         {
-            ThrowException(PhysicsViolation, "Cannot tell a MovableEntity to have static collision type");
+            ThrowException(PhysicsViolation, "Cannot tell a StaticEntity to have kinematic or dynamic collision type");
             return false;
         }
Index: code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2302)
+++ code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2303)
@@ -33,5 +33,7 @@
 #include <OgreSceneManager.h>
 
-#include "BulletCollision/CollisionShapes/btSphereShape.h"
+#include "BulletCollision/CollisionShapes/btCollisionShape.h"
+#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
 
 #include "util/Exception.h"
@@ -41,4 +43,6 @@
 
 #include "objects/Scene.h"
+#include "objects/worldentities/collisionshapes/CollisionShape.h"
+#include "objects/worldentities/collisionshapes/CompoundCollisionShape.h"
 
 namespace orxonox
@@ -68,4 +72,6 @@
         // Default behaviour does not include physics
         this->physicalBody_ = 0;
+        this->collisionShape_ = 0;
+        this->mass_ = 0;
         updateCollisionType();
 
@@ -100,12 +106,9 @@
 
         XMLPortParam(WorldEntity, "collisionType", setCollisionTypeStr, getCollisionTypeStr, xmlelement, mode);
-        XMLPortParam(WorldEntity, "collisionRadius", setCollisionRadius, getCollisionRadius, xmlelement, mode);
+        //XMLPortParam(WorldEntity, "collisionRadius", setCollisionRadius, getCollisionRadius, xmlelement, mode);
         XMLPortParam(WorldEntity, "mass", setMass, getMass, xmlelement, mode);
 
         XMLPortObject(WorldEntity, WorldEntity, "attached", attach, getAttachedObject, xmlelement, mode);
-
-        // Add the physical after loading because we cannot change its attributes without removing.
-        if (getCollisionType() != None)
-            this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
+        XMLPortObject(WorldEntity, CollisionShape, "collisionShapes", attachCollisionShape, getAttachedCollisionShape, xmlelement, mode);
     }
 
@@ -131,4 +134,27 @@
     void WorldEntity::attach(WorldEntity* object)
     {
+        // check first whether attaching is even allowed
+        if (object->hasPhysics())
+        {
+            if (!this->hasPhysics())
+                ThrowException(PhysicsViolation, "Cannot attach a physical object to a non physical one.");
+            else if (object->isDynamic())
+                ThrowException(PhysicsViolation, "Cannot attach a dynamic object to a WorldEntity.");
+            else if (object->isKinematic() && this->isDynamic())
+                ThrowException(PhysicsViolation, "Cannot attach a kinematic object to a dynamic one.");
+            else if (object->isKinematic())
+                ThrowException(NotImplemented, "Cannot attach a kinematic object to a static or kinematic one: Not yet implemented.");
+            else if (object->physicalBody_->isInWorld() || this->physicalBody_->isInWorld())
+                ThrowException(PhysicsViolation, "Cannot attach a physical object at runtime.");
+            else
+            {
+                // static to static/kinematic/dynamic --> merge shapes
+                this->attachCollisionShape(object->getCollisionShape());
+                // Remove the btRigidBody from the child object.
+                // That also implies that cannot add a physics WE to the child afterwards.
+                object->setCollisionType(None);
+            }
+        }
+
         if (object->getParent())
             object->detachFromParent();
@@ -144,29 +170,5 @@
         object->parent_ = this;
         object->parentID_ = this->getObjectID();
-
-        // Do the physical connection if required
-        //this->attachPhysicalObject(object);
-    }
-
-    //void WorldEntity::attachPhysicalObject(WorldEntity* object)
-    //{
-    //    StaticEntity* staticObject = dynamic_cast<StaticEntity*>(object);
-    //    if (staticObject != 0 && this->hasPhysics())
-    //    {
-    //       btCompoundShape* compoundShape = dynamic_cast<btCompoundShape*>(this->physicalBody_->getCollisionShape());
-    //       if (compoundShape == 0)
-    //       {
-    //            // create a compound shape and add both
-    //            compoundShape = new btCompoundShape();
-    //            compoundShape->addChildShape(this->physicalBody_->getCollisionShape());
-    //            compoundShape->addChildShape(staticObject->getCollisionShape());
-    //            this->physicalBody_->setCollisionShape();
-    //       }
-    //       else
-    //       {
-    //           compoundShape -> addChildShape(staticObject->getCollisionShape());
-    //       }
-    //    }
-    //}
+    }
 
     void WorldEntity::detach(WorldEntity* object)
@@ -192,28 +194,91 @@
     }
 
-    float WorldEntity::getMass() const
-    {
-        if (!checkPhysics())
-            return 0.0f;
-
-        if (this->physicalBody_->getInvMass() == 0.0f)
-            return 0.0f;
-        else
-            return 1.0f/this->physicalBody_->getInvMass();
+    void WorldEntity::mergeCollisionShape(CollisionShape* shape)
+    {
+        if (!this->collisionShape_)
+            this->collisionShape_ = new CompoundCollisionShape(this);
+        assert(this->collisionShape_->isCompoundShape());
+
+        // merge with transform
+        CompoundCollisionShape* compoundShape = static_cast<CompoundCollisionShape*>(this->collisionShape_);
+        assert(compoundShape);
+        compoundShape->addChildShape(shape);
+    }
+
+    void WorldEntity::attachCollisionShape(CollisionShape* shape)
+    {
+        this->attachedShapes_.push_back(shape);
+
+        if (!this->collisionShape_ && shape->hasNoTransform())
+        {
+            // Simply add the shape as is.
+            shape->getCollisionShape()->setLocalScaling(shape->getTotalScaling());
+            this->collisionShape_ = shape;
+        }
+        else
+        {
+            if (this->collisionShape_ && !this->collisionShape_->isCompoundShape())
+            {
+                // We have to create a new compound shape and add the old one first.
+                CollisionShape* thisShape = this->collisionShape_;
+                this->collisionShape_ = 0;
+                this->mergeCollisionShape(thisShape);
+            }
+            this->mergeCollisionShape(shape);
+        }
+
+        if (this->physicalBody_)
+        {
+            if (this->physicalBody_->isInWorld())
+                COUT(2) << "Warning: Cannot attach a physical object at runtime.";
+            else
+                this->physicalBody_->setCollisionShape(this->collisionShape_->getCollisionShape());
+        }
+    }
+
+    CollisionShape* WorldEntity::getAttachedCollisionShape(unsigned int index) const
+    {
+        if (index < this->attachedShapes_.size())
+            return attachedShapes_[index];
+        else
+            return 0;
+    }
+
+    //BlinkingBillboard* WorldEntity::getAttachedAsdfObject(unsigned int index) const
+    //{
+    //    return 0;
+    //}
+
+    void WorldEntity::setScale3D(const Vector3& scale)
+    {
+        if (this->hasPhysics())
+            ThrowException(NotImplemented, "Cannot set the scale of a physical object: Not yet implemented.");
+
+        this->node_->setScale(scale);
+    }
+
+    void WorldEntity::scale3D(const Vector3& scale)
+    {
+        if (this->hasPhysics())
+            ThrowException(NotImplemented, "Cannot set the scale of a physical object: Not yet implemented.");
+
+        this->node_->scale(scale);
     }
 
     void WorldEntity::setMass(float mass)
     {
-        if (!checkPhysics())
-            return;
+        this->mass_ = mass;
+        if (!hasPhysics())
+            COUT(2) << "Warning: Setting the mass of a WorldEntity with no physics has no effect." << std::endl;
         else if (this->physicalBody_->isInWorld())
-        {
-            CCOUT(2) << "Cannot set the physical mass at run time." << std::endl;
-            assert(false);
-        }
-        else
-        {
-            this->physicalBody_->setMassProps(mass, btVector3(0,0,0));
-            updateCollisionType();
+            COUT(2) << "Warning: Cannot set the physical mass at run time. Storing temporarily." << std::endl;
+        else
+        {
+            if (this->collisionType_ != Dynamic)
+                COUT(2) << "Warning: Cannot set the physical mass of a static or kinematic object. Storing temporarily." << std::endl;
+            else if (mass == 0.0f)
+                COUT(2) << "Warning: Cannot set physical mass of a dynamic object to zero. Storing temporarily." << std::endl;
+            else
+                this->physicalBody_->setMassProps(mass, btVector3(0,0,0));
         }
     }
@@ -221,20 +286,24 @@
     void WorldEntity::setCollisionType(CollisionType type)
     {
-        // Check first whether we have to create or destroy.
+        // If we are already attached to a parent, this would be a bad idea..
+        if (this->parent_)
+            ThrowException(PhysicsViolation, "Cannot set the collision type of a WorldEntity with a parent");
+        else if (this->physicalBody_ && this->physicalBody_->isInWorld())
+            ThrowException(PhysicsViolation, "Warning: Cannot set the collision type at run time.");
+
+        // Check for type legality. Could be StaticEntity or MovableEntity
+        if (!this->isCollisionTypeLegal(type))
+            return; // exception gets issued anyway
+
+        // Check whether we have to create or destroy.
         if (type != None && this->collisionType_ == None)
         {
-            // First, check whether our SceneNode is relative to the root space of the scene.
-            // TODO: Static and Kinematic objects don't always have to obey this rule.
-            if (this->node_->getParent() != this->getScene()->getRootSceneNode())
-                ThrowException(PhysicsViolation, "Cannot make WorldEntity physical that is not in the root space of the Scene.");
-
             // Create new rigid body
-            btRigidBody::btRigidBodyConstructionInfo bodyConstructionInfo(0, this, 0, btVector3(0,0,0));
+            btCollisionShape* temp = 0;
+            if (this->collisionShape_)
+                temp = this->collisionShape_->getCollisionShape();
+            btRigidBody::btRigidBodyConstructionInfo bodyConstructionInfo(0, this, temp, btVector3(0,0,0));
             this->physicalBody_ = new btRigidBody(bodyConstructionInfo);
             this->physicalBody_->setUserPointer(this);
-
-            // Adjust parameters according to the node
-            //btTransform nodeTransform;
-            //this->
         }
         else if (type == None && this->collisionType_ != None)
@@ -243,6 +312,4 @@
             if (this->physicalBody_->isInWorld())
                 this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
-            if (this->physicalBody_->getCollisionShape())
-                delete this->physicalBody_->getCollisionShape();
             delete this->physicalBody_;
             this->physicalBody_ = 0;
@@ -250,8 +317,4 @@
             return;
         }
-
-        // Check for type legality. Could be StaticEntity or MovableEntity
-        if (!this->isCollisionTypeLegal(type))
-            return; // exception gets issued anyway
 
         // Change type
@@ -271,13 +334,15 @@
         }
 
+        // update our variable for faster checks
+        updateCollisionType();
+
         // Mass non zero is a bad idea for kinematic and static objects
-        if ((type == Kinematic || type == Static) && getMass() != 0.0f)
+        if ((type == Kinematic || type == Static) && this->mass_ != 0.0f)
             this->setMass(0.0f);
         // Mass zero is not such a good idea for dynamic objects
-        else if (type == Dynamic && getMass() == 0.0f)
+        else if (type == Dynamic && this->mass_ == 0.0f)
             this->setMass(1.0f);
-
-        // finally update our variable for faster checks
-        updateCollisionType();
+        else if (hasPhysics())
+            this->physicalBody_->setMassProps(this->mass_, btVector3(0,0,0));
     }
 
@@ -329,27 +394,39 @@
     }
 
-    void WorldEntity::setCollisionRadius(float radius)
-    {
-        if (!checkPhysics())
-            return;
-
-        // destroy old one first
-        btCollisionShape* oldShape = this->physicalBody_->getCollisionShape();
-        if (oldShape)
-            delete oldShape;
-
-        this->physicalBody_->setCollisionShape(new btSphereShape(btScalar(radius)));
-    }
-
-    float WorldEntity::getCollisionRadius() const
-    {
-        if (checkPhysics())
-        {
-            btSphereShape* sphere = dynamic_cast<btSphereShape*>(this->physicalBody_->getCollisionShape());
-            if (sphere)
-                return (float)sphere->getRadius();
-        }
-        return 0.0f;
-    }
+    //void WorldEntity::setCollisionRadius(float radius)
+    //{
+    //    if (!checkPhysics())
+    //        return;
+
+    //    // destroy old one first
+    //    btCollisionShape* oldShape = this->physicalBody_->getCollisionShape();
+    //    if (oldShape)
+    //        delete oldShape;
+
+    //    //if (this->getName() == "blubb")
+    //    //{
+    //    //    btCompoundShape* cShape = new btCompoundShape();
+    //    //    cShape->setLocalScaling(btVector3(1,1,1));
+    //    //    btTransform offset(btQuaternion(0, 0, 0), btVector3(0, 0, 0));
+    //    //    offset.setBasis(btMatrix3x3(3, 0, 0, 0, 3, 0, 0, 0, 3));
+    //    //    btSphereShape* sphere = new btSphereShape(radius);
+    //    //    sphere->setLocalScaling(btVector3(1,1,3));
+    //    //    cShape->addChildShape(offset, sphere);
+    //    //    this->physicalBody_->setCollisionShape(cShape);
+    //    //}
+    //    //else
+    //    this->physicalBody_->setCollisionShape(new btSphereShape(btScalar(radius)));
+    //}
+
+    //float WorldEntity::getCollisionRadius() const
+    //{
+    //    if (checkPhysics())
+    //    {
+    //        btSphereShape* sphere = dynamic_cast<btSphereShape*>(this->physicalBody_->getCollisionShape());
+    //        if (sphere)
+    //            return (float)sphere->getRadius();
+    //    }
+    //    return 0.0f;
+    //}
 
     bool WorldEntity::checkPhysics() const
Index: code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2302)
+++ code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2303)
@@ -36,5 +36,4 @@
 
 #include "LinearMath/btMotionState.h"
-#include "BulletDynamics/Dynamics/btRigidBody.h"
 
 #include "network/Synchronisable.h"
@@ -108,26 +107,26 @@
                 { this->setDirection(Vector3(x, y, z), relativeTo, localDirectionVector); }
 
-            inline void setScale3D(const Vector3& scale)
-                { this->node_->setScale(scale); }
+            void setScale3D(const Vector3& scale);
             inline void setScale3D(float x, float y, float z)
-                { this->node_->setScale(x, y, z); }
+                { this->setScale3D(Vector3(x, y, z)); }
             inline const Vector3& getScale3D(void) const
                 { return this->node_->getScale(); }
 
-            inline void setScale(float scale)
-                { this->node_->setScale(scale, scale, scale); }
+            void setScale(float scale)
+                { this->setScale3D(scale, scale, scale); }
             inline float getScale() const
                 { Vector3 scale = this->getScale3D(); return (scale.x == scale.y && scale.x == scale.z) ? scale.x : 1; }
 
-            inline void scale3D(const Vector3& scale)
-                { this->node_->scale(scale); }
+            void scale3D(const Vector3& scale);
             inline void scale3D(float x, float y, float z)
-                { this->node_->scale(x, y, z); }
+                { this->scale3D(Vector3(x, y, z)); }
             inline void scale(float scale)
-                { this->node_->scale(scale, scale, scale); }
+                { this->scale3D(scale, scale, scale); }
 
             void attach(WorldEntity* object);
+//            void attachAsdf(BlinkingBillboard* object);
             void detach(WorldEntity* object);
             WorldEntity* getAttachedObject(unsigned int index) const;
+//            BlinkingBillboard* getAttachedAsdfObject(unsigned int index) const;
             inline const std::set<WorldEntity*>& getAttachedObjects() const
                 { return this->children_; }
@@ -195,8 +194,12 @@
 
             void setMass(float mass);
-            float getMass() const;
-
-            void setCollisionRadius(float radius);
-            float getCollisionRadius() const;
+            inline float getMass() const
+                { return this->mass_; }
+
+            void attachCollisionShape(CollisionShape* shape);
+            CollisionShape* getAttachedCollisionShape(unsigned int index) const;
+
+            CollisionShape* getCollisionShape() { return this->collisionShape_; }
+            btRigidBody* getPhysicalBody() { return this->physicalBody_; }
 
         protected:
@@ -211,6 +214,10 @@
 
         private:
-            CollisionType collisionType_;
-
+            void mergeCollisionShape(CollisionShape* shape);
+
+            CollisionType                collisionType_;
+            std::vector<CollisionShape*> attachedShapes_;
+            CollisionShape*              collisionShape_;
+            btScalar                     mass_;
     };
 }
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.cc	(revision 2303)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.cc	(revision 2303)
@@ -0,0 +1,80 @@
+/*
+ *   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 "CollisionShape.h"
+
+#include "BulletCollision/CollisionShapes/btCollisionShape.h"
+
+#include "util/Exception.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+    CreateFactory(CollisionShape);
+
+    CollisionShape::CollisionShape(BaseObject* creator) : StaticEntity(creator)
+    {
+        RegisterObject(CollisionShape);
+
+        this->bIsCompound_ = false;
+    }
+
+    CollisionShape::~CollisionShape()
+    {
+    }
+
+    void CollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(CollisionShape, XMLPort, xmlelement, mode);
+    }
+
+    bool CollisionShape::isCollisionTypeLegal(WorldEntity::CollisionType type) const
+    {
+        if (type != WorldEntity::None)
+        {
+            ThrowException(PhysicsViolation, "A CollisionShape can only have CollisionType 'None'.");
+            return false;
+        }
+        else
+            return true;
+    }
+
+    bool CollisionShape::hasNoTransform() const
+    {
+        return (this->getPosition().positionEquals(Vector3(0, 0, 0), 0.001) &&
+                this->getOrientation().equals(Quaternion(1,0,0,0), Degree(0.1)));
+    }
+
+    btVector3 CollisionShape::getTotalScaling()
+    {
+        return omni_cast<btVector3>(this->node_->getScale());
+    }
+}
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.h	(revision 2303)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.h	(revision 2303)
@@ -0,0 +1,61 @@
+/*
+ *   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 _CollisionShape_H__
+#define _CollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "objects/worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport CollisionShape : public StaticEntity
+    {
+        public:
+            CollisionShape(BaseObject* creator);
+            virtual ~CollisionShape();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            btCollisionShape* getCollisionShape() const { return this->collisionShape_; }
+            bool isCompoundShape() const { return this->bIsCompound_; }
+
+            bool hasNoTransform() const;
+            virtual btVector3 getTotalScaling();
+
+        protected:
+            bool              bIsCompound_;
+            btCollisionShape* collisionShape_;
+
+        private:
+            bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
+    };
+}
+
+#endif /* _CollisionShape_H__ */
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.cc	(revision 2303)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.cc	(revision 2303)
@@ -0,0 +1,79 @@
+/*
+ *   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 "CompoundCollisionShape.h"
+
+#include "BulletCollision/CollisionShapes/btCompoundShape.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+    CreateFactory(CompoundCollisionShape);
+
+    CompoundCollisionShape::CompoundCollisionShape(BaseObject* creator) : CollisionShape(creator)
+    {
+        RegisterObject(CompoundCollisionShape);
+
+        this->bIsCompound_    = true;
+        this->compoundShape_  = new btCompoundShape();
+        this->collisionShape_ = this->compoundShape_;
+    }
+
+    CompoundCollisionShape::~CompoundCollisionShape()
+    {
+        if (this->isInitialized())
+            delete this->compoundShape_;
+    }
+
+    void CompoundCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(CompoundCollisionShape, XMLPort, xmlelement, mode);
+
+        XMLPortObject(CompoundCollisionShape, CollisionShape, "", addChildShape, getChildShape, xmlelement, mode);
+    }
+
+    void CompoundCollisionShape::addChildShape(CollisionShape* shape)
+    {
+        this->childShapes_.push_back(shape);
+        btTransform transf(omni_cast<btQuaternion>(shape->getOrientation()), omni_cast<btVector3>(shape->getPosition()));
+        shape->getCollisionShape()->setLocalScaling(shape->getTotalScaling());
+        this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
+    }
+
+    CollisionShape* CompoundCollisionShape::getChildShape(unsigned int index) const
+    {
+        if (index < this->childShapes_.size())
+            return this->childShapes_[index];
+        else
+            return 0;
+    }
+}
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.h	(revision 2303)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.h	(revision 2303)
@@ -0,0 +1,56 @@
+/*
+ *   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 _CompoundCollisionShape_H__
+#define _CompoundCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <vector>
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport CompoundCollisionShape : public CollisionShape
+    {
+        public:
+            CompoundCollisionShape(BaseObject* creator);
+            virtual ~CompoundCollisionShape();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            void addChildShape(CollisionShape* shape);
+            CollisionShape* getChildShape(unsigned int index) const;
+
+        private:
+            btCompoundShape* compoundShape_;
+            std::vector<CollisionShape*> childShapes_;
+    };
+}
+
+#endif /* _CompoundCollisionShape_H__ */
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.cc	(revision 2303)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.cc	(revision 2303)
@@ -0,0 +1,67 @@
+/*
+ *   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 "SphereCollisionShape.h"
+
+#include "BulletCollision/CollisionShapes/btSphereShape.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
+
+namespace orxonox
+{
+    CreateFactory(SphereCollisionShape);
+
+    SphereCollisionShape::SphereCollisionShape(BaseObject* creator) : CollisionShape(creator)
+    {
+        RegisterObject(SphereCollisionShape);
+
+        this->sphereShape_ = new btSphereShape(1.0f);
+        this->collisionShape_ = this->sphereShape_;
+    }
+
+    SphereCollisionShape::~SphereCollisionShape()
+    {
+        if (this->isInitialized())
+            delete this->collisionShape_;
+    }
+
+    void SphereCollisionShape::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(SphereCollisionShape, XMLPort, xmlelement, mode);
+
+        XMLPortParam(SphereCollisionShape, "radius", setRadius, getRadius, xmlelement, mode);
+    }
+
+    btVector3 SphereCollisionShape::getTotalScaling()
+    {
+        return omni_cast<btVector3>(this->node_->getScale()) * this->radius_;
+    }
+}
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.h	(revision 2303)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.h	(revision 2303)
@@ -0,0 +1,59 @@
+/*
+ *   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 _SphereCollisionShape_H__
+#define _SphereCollisionShape_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "CollisionShape.h"
+
+namespace orxonox
+{
+    class _OrxonoxExport SphereCollisionShape : public CollisionShape
+    {
+        public:
+            SphereCollisionShape(BaseObject* creator);
+            virtual ~SphereCollisionShape();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            inline void setRadius(float radius)
+                { this->radius_ = radius; }
+            inline float getRadius() const
+                { return this->radius_;}
+
+        private:
+            virtual btVector3 getTotalScaling();
+
+            btSphereShape* sphereShape_;
+            float          radius_;
+    };
+}
+
+#endif /* _SphereCollisionShape_H__ */
Index: code/branches/physics/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2302)
+++ code/branches/physics/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2303)
@@ -29,4 +29,6 @@
 #include "OrxonoxStableHeaders.h"
 #include "SpaceShip.h"
+
+#include "BulletDynamics/Dynamics/btRigidBody.h"
 
 #include "util/Math.h"
