Index: code/branches/physics/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/physics/src/orxonox/CMakeLists.txt	(revision 2373)
+++ code/branches/physics/src/orxonox/CMakeLists.txt	(revision 2374)
@@ -46,5 +46,4 @@
   objects/EventDispatcher.cc
   objects/EventTarget.cc
-  objects/HelloBullet.cc
   objects/Radar.cc
   objects/RadarListener.cc
Index: code/branches/physics/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/branches/physics/src/orxonox/OrxonoxPrereqs.h	(revision 2373)
+++ code/branches/physics/src/orxonox/OrxonoxPrereqs.h	(revision 2374)
@@ -154,4 +154,6 @@
     class CollisionShape;
     class SphereCollisionShape;
+    class CompoundCollisionShape;
+    class PlaneCollisionShape;
 
     // tools
@@ -217,4 +219,5 @@
 class btSphereShape;
 class btCompoundShape;
+class btStaticPlaneShape;
 
 class btDiscreteDynamicsWorld;
Index: code/branches/physics/src/orxonox/objects/HelloBullet.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/HelloBullet.cc	(revision 2373)
+++ 	(revision )
@@ -1,182 +1,0 @@
-/*
- *   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:
- *      Martin Stypinski
- *   Co-authors:
- *      ...
- *
- */
-
-#include "OrxonoxStableHeaders.h"
-#include "HelloBullet.h"
-
-#include <OgreSceneNode.h>
-#include <OgreStaticGeometry.h>
-#include <OgreSceneManager.h>
-#include <OgreEntity.h>
-
-#include "util/Convert.h"
-#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/XMLPort.h"
-#include "objects/Scene.h"
-
-#include "util/Sleep.h"
-
-
-namespace orxonox
-{
-    CreateFactory(HelloBullet);
-    
-    HelloBullet::HelloBullet(BaseObject* creator)
-        : BaseObject(creator)
-    {
-        RegisterObject(HelloBullet);
-        COUT(0) << "HelloBullet loaded" << std::endl ;
-        int maxProxies = 1024;
-
-
-  //      btVector3 worldAabbMin(-10000,-10000,-10000);
-  //      btVector3 worldAabbMax(10000,10000,10000);
-  //      btAxisSweep3* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
-
-  //      btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
-  //      btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
-
-  //      btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
-
-  //      dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);
-
-        dynamicsWorld = getCreator()->getScene()->getPhysicalWorld();
-
-
-        btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),1);
-
-        btCollisionShape* fallShape = new btSphereShape(1);
-
-
-        btDefaultMotionState* groundMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,-1,0)));
-        btRigidBody::btRigidBodyConstructionInfo
-                groundRigidBodyCI(0,groundMotionState,groundShape,btVector3(0,0,0));
-        btRigidBody* groundRigidBody = new btRigidBody(groundRigidBodyCI);
-        dynamicsWorld->addRigidBody(groundRigidBody);
-
-
-        btDefaultMotionState* fallMotionState =
-                new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,100,0)));
-        btScalar mass = 1000;
-        btVector3 fallInertia(0,0,0);
-        fallShape->calculateLocalInertia(mass,fallInertia);
-        btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass,fallMotionState,fallShape,fallInertia);
-        fallRigidBody = new btRigidBody(fallRigidBodyCI);
-        dynamicsWorld->addRigidBody(fallRigidBody);
-
- 
-        //load floor mash
-        Ogre::SceneManager* sceneMgr = creator->getScene()->getSceneManager();
-
-        int i = 0;
-        Ogre::StaticGeometry* floor;
-        floor = sceneMgr->createStaticGeometry("StaticFloor");
-        floor->setRegionDimensions(Ogre::Vector3(160.0, 100.0, 160.0));
-        // Set the region origin so the center is at 0 world
-        floor->setOrigin(Ogre::Vector3::ZERO);
-        for (Real z = -80.0; z <= 80.0; z += 20.0)
-        {
-            for (Real x = -80.0; x <= 80.0; x += 20.0)
-            {
-                std::string name = std::string("Ground") + convertToString(i++);
-                Ogre::Entity* entity = sceneMgr->createEntity(name, "plane.mesh");
-                entity->setQueryFlags (1<<4);
-                entity->setCastShadows(false);
-                floor->addEntity(entity, Ogre::Vector3(x,0,z));
-            }
-        }       
-
-        floor->build();
-
-
-        // crate
-
-        entity_ = sceneMgr->createEntity("crate","crate.mesh");
-        entity_->setQueryFlags (1<<2);
-        sceneNode_ = sceneMgr->getRootSceneNode()->createChildSceneNode("crate");
-        sceneNode_->attachObject(entity_);
-        entity_->setNormaliseNormals(true);
-        entity_->setCastShadows(true);
-        sceneNode_ -> setPosition(Vector3(0,100,0));
-    }
-
-    HelloBullet::~HelloBullet()
-    {
-     //  dynamicsWorld->removeRigidBody(fallRigidBody);
-     //   delete fallRigidBody->getMotionState();
-     //   delete fallRigidBody;
-
-     //   dynamicsWorld->removeRigidBody(groundRigidBody);
-     //   delete groundRigidBody->getMotionState();
-     //   delete groundRigidBody;
-
-
-     //   delete fallShape;
-
-     //   delete groundShape;
-
-
-     //   delete dynamicsWorld;
-     //   delete solver;
-     //   delete collisionConfiguration;
-     //   delete dispatcher;
-     //   delete broadphase;
-
-    }
-
-    void HelloBullet::setConfigValues()
-    {
-
-    }
-
-    /**
-    @brief
-        XML loading and saving.
-    @param
-        xmlelement The XML-element
-    @param	
-        loading Loading (true) or saving (false)
-    @return
-        The XML-element
-    */
-    void HelloBullet::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-      SUPER(HelloBullet, XMLPort, xmlelement, mode);
-    }
-
-    void HelloBullet::tick(float dt)
-    {
-        dynamicsWorld->stepSimulation(dt,10);
-        btTransform trans;
-        fallRigidBody->getMotionState()->getWorldTransform(trans);
-        // COUT(0) << "sphere height: " << trans.getOrigin().getY() << std::endl;
-        sceneNode_ -> setPosition(Vector3(0,trans.getOrigin().getY(),0));
-        //	msleep(20);
-    }
-}
Index: code/branches/physics/src/orxonox/objects/HelloBullet.h
===================================================================
--- code/branches/physics/src/orxonox/objects/HelloBullet.h	(revision 2373)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/*
- *   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:
- *      Martin Stypinski
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _HelloBullet_H__
-#define _HelloBullet_H__
-
-#include "OrxonoxPrereqs.h"
-#include "core/BaseObject.h"
-#include <OgrePrerequisites.h>
-
-#include "btBulletCollisionCommon.h"
-#include "btBulletDynamicsCommon.h"
-
-#include "Tickable.h"
-
-namespace orxonox
-{
-    class _OrxonoxExport HelloBullet : public BaseObject, public Tickable
-    {
-    public:
-        HelloBullet(BaseObject* creator);
-        virtual ~HelloBullet();
-        void setConfigValues();
-
-        virtual void tick(float dt);
-
-        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
-    private:
-        Ogre::SceneNode*                sceneNode_;
-        Ogre::Entity*                   entity_;
-	btRigidBody* fallRigidBody;
-  	btDiscreteDynamicsWorld* dynamicsWorld;
-    };
-
-
-}
-
-
-
-#endif /* _HelloBullet_H__ */
Index: code/branches/physics/src/orxonox/objects/Scene.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/Scene.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/Scene.cc	(revision 2374)
@@ -43,4 +43,5 @@
 #include "core/Core.h"
 #include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
 #include "objects/worldentities/WorldEntity.h"
 
@@ -117,10 +118,10 @@
         XMLPortParam(Scene, "shadow", setShadow, getShadow, xmlelement, mode).defaultValues(true);
 
-        const int defaultMaxWorldSize = 100000;
-        Vector3 worldAabbMin(-defaultMaxWorldSize, -defaultMaxWorldSize, -defaultMaxWorldSize);
-        Vector3 worldAabbMax( defaultMaxWorldSize,  defaultMaxWorldSize,  defaultMaxWorldSize);
-        XMLPortParamVariable(Scene, "negativeWorldRange", worldAabbMin, xmlelement, mode);
-        XMLPortParamVariable(Scene, "positiveWorldRange", worldAabbMax, xmlelement, mode);
-        XMLPortParam(Scene, "hasPhysics", setPhysicalWorld, hasPhysics, xmlelement, mode).defaultValue(0, true).defaultValue(1, worldAabbMin).defaultValue(2, worldAabbMax);
+        //const int defaultMaxWorldSize = 100000;
+        //Vector3 worldAabbMin(-defaultMaxWorldSize, -defaultMaxWorldSize, -defaultMaxWorldSize);
+        //Vector3 worldAabbMax( defaultMaxWorldSize,  defaultMaxWorldSize,  defaultMaxWorldSize);
+        //XMLPortParamVariable(Scene, "negativeWorldRange", worldAabbMin, xmlelement, mode);
+        //XMLPortParamVariable(Scene, "positiveWorldRange", worldAabbMax, xmlelement, mode);
+        XMLPortParam(Scene, "hasPhysics", setPhysicalWorld, hasPhysics, xmlelement, mode).defaultValue(0, true);//.defaultValue(1, worldAabbMin).defaultValue(2, worldAabbMax);
 
         XMLPortObjectExtended(Scene, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
@@ -131,18 +132,20 @@
         REGISTERSTRING(this->skybox_,     network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox));
         REGISTERDATA(this->ambientLight_, network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight));
-    }
-
-    void Scene::setPhysicalWorld(bool wantPhysics, const Vector3& worldAabbMin, const Vector3& worldAabbMax)
-    {
+        REGISTERDATA(this->bHasPhysics_,  network::direction::toclient, new network::NetworkCallback<Scene>(this, &Scene::networkcallback_hasPhysics));
+    }
+
+    void Scene::setPhysicalWorld(bool wantPhysics)//, const Vector3& worldAabbMin, const Vector3& worldAabbMax)
+    {
+        this->bHasPhysics_ = wantPhysics;
         if (wantPhysics && !hasPhysics())
         {
-			float x = worldAabbMin.x;
-			float y = worldAabbMin.y;
-			float z = worldAabbMin.z;
-            btVector3 worldAabbMin(x,y,z);
-			x = worldAabbMax.x;
-			y = worldAabbMax.y;
-			z = worldAabbMax.z;
-            btVector3 worldAabbMax(x,y,z);
+            //float x = worldAabbMin.x;
+            //float y = worldAabbMin.y;
+            //float z = worldAabbMin.z;
+            btVector3 worldAabbMin(-100000, -100000, -100000);
+            //x = worldAabbMax.x;
+            //y = worldAabbMax.y;
+            //z = worldAabbMax.z;
+            btVector3 worldAabbMax(100000, 100000, 100000);
 
             btDefaultCollisionConfiguration*     collisionConfig = new btDefaultCollisionConfiguration();
@@ -173,5 +176,13 @@
                 {
                     if (!(*it)->isInWorld())
+                    {
+                        //COUT(0) << "body position: " << omni_cast<Vector3>((*it)->getWorldTransform().getOrigin()) << std::endl;
+                        //COUT(0) << "body velocity: " << omni_cast<Vector3>((*it)->getLinearVelocity()) << std::endl;
+                        //COUT(0) << "body orientation: " << omni_cast<Quaternion>((*it)->getWorldTransform().getRotation()) << std::endl;
+                        //COUT(0) << "body angular: " << omni_cast<Vector3>((*it)->getAngularVelocity()) << std::endl;
+                        //COUT(0) << "body mass: " << omni_cast<float>((*it)->getInvMass()) << std::endl;
+                        //COUT(0) << "body inertia: " << omni_cast<Vector3>((*it)->getInvInertiaDiagLocal()) << std::endl;
                         this->physicalWorld_->addRigidBody(*it);
+                    }
                 }
                 this->physicsQueue_.clear();
@@ -234,5 +245,5 @@
     {
         if (!this->physicalWorld_)
-            COUT(1) << "Error: Cannot WorldEntity body to physical Scene: No physics." << std::endl;
+            COUT(1) << "Error: Cannot add WorldEntity body to physical Scene: No physics." << std::endl;
         else if (body)
             this->physicsQueue_.insert(body);
@@ -242,5 +253,5 @@
     {
         if (!this->physicalWorld_)
-            COUT(1) << "Error: Cannot WorldEntity body to physical Scene: No physics." << std::endl;
+            COUT(1) << "Error: Cannot remove WorldEntity body from physical Scene: No physics." << std::endl;
         else if (body)
         {
Index: code/branches/physics/src/orxonox/objects/Scene.h
===================================================================
--- code/branches/physics/src/orxonox/objects/Scene.h	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/Scene.h	(revision 2374)
@@ -70,5 +70,5 @@
             inline bool hasPhysics()
                 { return this->physicalWorld_ != 0; }
-            void setPhysicalWorld(bool wantsPhysics, const Vector3& worldAabbMin, const Vector3& worldAabbMax);
+            void setPhysicalWorld(bool wantsPhysics);//, const Vector3& worldAabbMin, const Vector3& worldAabbMax);
 
             void addRigidBody(btRigidBody* body);
@@ -85,15 +85,18 @@
             void networkcallback_applyAmbientLight()
                 { this->setAmbientLight(this->ambientLight_); }
+            void networkcallback_hasPhysics()
+                { this->setPhysicalWorld(this->bHasPhysics_); }
 
-            Ogre::SceneManager*    sceneManager_;
-            Ogre::SceneNode*       rootSceneNode_;
+            Ogre::SceneManager*      sceneManager_;
+            Ogre::SceneNode*         rootSceneNode_;
 
             btDiscreteDynamicsWorld* physicalWorld_;
             std::set<btRigidBody*>   physicsQueue_;
+            bool                     bHasPhysics_;
 
-            std::string            skybox_;
-            ColourValue            ambientLight_;
-            std::list<BaseObject*> objects_;
-            bool                   bShadows_;
+            std::string              skybox_;
+            ColourValue              ambientLight_;
+            std::list<BaseObject*>   objects_;
+            bool                     bShadows_;
     };
 }
Index: code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 2374)
@@ -57,12 +57,12 @@
         this->bDestroyWhenPlayerLeft_ = false;
 
-        this->acceleration_ = Vector3::ZERO;
-
-        this->server_position_ = Vector3::ZERO;
-        this->client_position_ = Vector3::ZERO;
-        this->server_velocity_ = Vector3::ZERO;
-        this->client_velocity_ = Vector3::ZERO;
-        this->server_orientation_ = Quaternion::IDENTITY;
-        this->client_orientation_ = Quaternion::IDENTITY;
+        this->server_position_         = Vector3::ZERO;
+        this->client_position_         = Vector3::ZERO;
+        this->server_linear_velocity_  = Vector3::ZERO;
+        this->client_linear_velocity_  = Vector3::ZERO;
+        this->server_orientation_      = Quaternion::IDENTITY;
+        this->client_orientation_      = Quaternion::IDENTITY;
+        this->server_angular_velocity_ = Vector3::ZERO;
+        this->client_angular_velocity_ = Vector3::ZERO;
 
         this->registerVariables();
@@ -226,23 +226,8 @@
     void ControllableEntity::tick(float dt)
     {
+        MovableEntity::tick(dt);
+
         if (this->isActive())
         {
-            if (!this->isDynamic())
-            {
-                this->velocity_ += (dt * this->acceleration_);
-                this->node_->translate(dt * this->velocity_, Ogre::Node::TS_LOCAL);
-            }
-
-            if (Core::isMaster())
-            {
-                this->server_velocity_ = this->velocity_;
-                this->server_position_ = this->node_->getPosition();
-            }
-            else if (this->bControlled_)
-            {
-//                COUT(2) << "setting client position" << endl;
-                this->client_velocity_ = this->velocity_;
-                this->client_position_ = this->node_->getPosition();
-            }
         }
     }
@@ -252,15 +237,16 @@
         REGISTERSTRING(this->cameraPositionTemplate_, network::direction::toclient);
 
-        REGISTERDATA(this->server_position_,    network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
-        REGISTERDATA(this->server_velocity_,    network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerVelocity));
-        REGISTERDATA(this->server_orientation_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
-
-        REGISTERDATA(this->server_overwrite_,   network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
-        REGISTERDATA(this->client_overwrite_,   network::direction::toserver);
-
-        REGISTERDATA(this->client_position_,    network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
-        REGISTERDATA(this->client_velocity_,    network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientVelocity));
-        REGISTERDATA(this->client_orientation_, network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
-
+        REGISTERDATA(this->server_position_,         network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
+        REGISTERDATA(this->server_linear_velocity_,  network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity));
+        REGISTERDATA(this->server_orientation_,      network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
+        REGISTERDATA(this->server_angular_velocity_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity));
+
+        REGISTERDATA(this->server_overwrite_,        network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
+        REGISTERDATA(this->client_overwrite_,        network::direction::toserver);
+
+        REGISTERDATA(this->client_position_,         network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
+        REGISTERDATA(this->client_linear_velocity_,  network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientLinearVelocity));
+        REGISTERDATA(this->client_orientation_,      network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
+        REGISTERDATA(this->client_angular_velocity_, network::direction::toserver, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientAngularVelocity));
 
         REGISTERDATA(this->playerID_, network::direction::toclient, new network::NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));
@@ -270,11 +256,14 @@
     {
         if (!this->bControlled_)
-            this->node_->setPosition(this->server_position_);
-    }
-
-    void ControllableEntity::processServerVelocity()
-    {
-        if (!this->bControlled_)
-            this->velocity_ = this->server_velocity_;
+        {
+            //COUT(0) << "override with server position: " << this << std::endl;
+            this->setPosition(this->server_position_);
+        }
+    }
+
+    void ControllableEntity::processServerLinearVelocity()
+    {
+        if (!this->bControlled_)
+            this->setVelocity(this->server_linear_velocity_);
     }
 
@@ -282,37 +271,47 @@
     {
         if (!this->bControlled_)
-            this->node_->setOrientation(this->server_orientation_);
+            this->setOrientation(this->server_orientation_);
+    }
+
+    void ControllableEntity::processServerAngularVelocity()
+    {
+        if (!this->bControlled_)
+            this->setAngularVelocity(this->server_angular_velocity_);
     }
 
     void ControllableEntity::processOverwrite()
     {
-        if (this->bControlled_)
-        {
-            this->setPosition(this->server_position_);
-            this->setVelocity(this->server_velocity_);
-            this->setOrientation(this->server_orientation_);
-
-            this->client_overwrite_ = this->server_overwrite_;
-        }
+        //if (this->bControlled_)
+        //{
+        //    COUT(0) << "complete override: " << this << std::endl;
+        //    this->setPosition(this->server_position_);
+        //    this->setVelocity(this->server_velocity_);
+        //    this->setOrientation(this->server_orientation_);
+
+        //    this->client_overwrite_ = this->server_overwrite_;
+        //}
     }
 
     void ControllableEntity::processClientPosition()
     {
-        if (this->server_overwrite_ == this->client_overwrite_)
-        {
+        //if (this->server_overwrite_ == this->client_overwrite_)
+        if (!this->bControlled_)
+        {
+            //COUT(0) << "override with client position: " << this << std::endl;
 //            COUT(2) << "callback: setting client position" << endl;
-            this->node_->setPosition(this->client_position_);
-            this->server_position_ = this->client_position_;
-        }
-//        else
-//          COUT(2) << "callback: not setting client position" << endl;
-    }
-
-    void ControllableEntity::processClientVelocity()
-    {
-        if (this->server_overwrite_ == this->client_overwrite_)
-        {
-            this->velocity_ = this->client_velocity_;
-            this->server_velocity_ = this->client_velocity_;
+            this->setPosition(this->client_position_);
+            //this->server_position_ = this->client_position_;
+        }
+        //else
+        //  COUT(2) << "callback: not setting client position" << endl;
+    }
+
+    void ControllableEntity::processClientLinearVelocity()
+    {
+        if (!this->bControlled_)
+        //if (this->server_overwrite_ == this->client_overwrite_)
+        {
+            this->setVelocity(this->client_linear_velocity_);
+            //this->server_velocity_ = this->client_velocity_;
         }
     }
@@ -320,12 +319,23 @@
     void ControllableEntity::processClientOrientation()
     {
-        if (this->server_overwrite_ == this->client_overwrite_)
-        {
-            this->node_->setOrientation(this->client_orientation_);
-            this->server_orientation_ = this->client_orientation_;
-        }
-    }
-
-    void ControllableEntity::positionChanged()
+        if (!this->bControlled_)
+        //if (this->server_overwrite_ == this->client_overwrite_)
+        {
+            this->setOrientation(this->client_orientation_);
+            //this->server_orientation_ = this->client_orientation_;
+        }
+    }
+
+    void ControllableEntity::processClientAngularVelocity()
+    {
+        if (!this->bControlled_)
+        //if (this->server_overwrite_ == this->client_overwrite_)
+        {
+            this->setAngularVelocity(this->client_angular_velocity_);
+            //this->server_velocity_ = this->client_velocity_;
+        }
+    }
+
+    void ControllableEntity::positionChanged(bool bContinuous)
     {
         if (Core::isMaster())
@@ -340,5 +350,5 @@
     }
 
-    void ControllableEntity::orientationChanged()
+    void ControllableEntity::orientationChanged(bool bContinuous)
     {
         if (Core::isMaster())
@@ -353,14 +363,27 @@
     }
 
-    void ControllableEntity::velocityChanged()
+    void ControllableEntity::linearVelocityChanged(bool bContinuous)
     {
         if (Core::isMaster())
         {
-            this->server_velocity_ = this->getVelocity();
+            this->server_linear_velocity_ = this->getVelocity();
             ++this->server_overwrite_;
         }
         else if (this->bControlled_)
         {
-            this->client_velocity_ = this->getVelocity();
+            this->client_linear_velocity_ = this->getVelocity();
+        }
+    }
+
+    void ControllableEntity::angularVelocityChanged(bool bContinuous)
+    {
+        if (Core::isMaster())
+        {
+            this->server_angular_velocity_ = this->getAngularVelocity();
+            ++this->server_overwrite_;
+        }
+        else if (this->bControlled_)
+        {
+            this->client_angular_velocity_ = this->getAngularVelocity();
         }
     }
Index: code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.h	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.h	(revision 2374)
@@ -33,9 +33,8 @@
 
 #include "MovableEntity.h"
-#include "objects/Tickable.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport ControllableEntity : public MovableEntity, public Tickable
+    class _OrxonoxExport ControllableEntity : public MovableEntity
     {
         public:
@@ -72,15 +71,6 @@
             virtual void switchCamera();
 
-            inline const Vector3& getVelocity() const
-                { return this->velocity_; }
-            inline const Vector3& getAcceleration() const
-                { return this->acceleration_; }
             inline const std::string& getHudTemplate() const
                 { return this->hudtemplate_; }
-
-            inline void setAcceleration(const Vector3& acceleration)
-                { this->acceleration_ = acceleration; }
-            inline void setAcceleration(float x, float y, float z)
-                { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
 
             inline Camera* getCamera() const
@@ -109,6 +99,4 @@
                 { return this->bControlled_; }
 
-            Vector3 acceleration_;
-
         private:
             void overwrite();
@@ -116,14 +104,17 @@
 
             void processServerPosition();
-            void processServerVelocity();
+            void processServerLinearVelocity();
             void processServerOrientation();
+            void processServerAngularVelocity();
 
             void processClientPosition();
-            void processClientVelocity();
+            void processClientLinearVelocity();
             void processClientOrientation();
+            void processClientAngularVelocity();
 
-            void positionChanged();
-            void orientationChanged();
-            void velocityChanged();
+            void positionChanged       (bool bContinuous);
+            void orientationChanged    (bool bContinuous);
+            void linearVelocityChanged (bool bContinuous);
+            void angularVelocityChanged(bool bContinuous);
 
             void networkcallback_changedplayerID();
@@ -135,8 +126,10 @@
             Vector3 server_position_;
             Vector3 client_position_;
-            Vector3 server_velocity_;
-            Vector3 client_velocity_;
+            Vector3 server_linear_velocity_;
+            Vector3 client_linear_velocity_;
             Quaternion server_orientation_;
             Quaternion client_orientation_;
+            Vector3 server_angular_velocity_;
+            Vector3 client_angular_velocity_;
 
             PlayerInfo* player_;
Index: code/branches/physics/src/orxonox/objects/worldentities/LinearEntity.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/LinearEntity.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/LinearEntity.cc	(revision 2374)
@@ -45,10 +45,5 @@
         RegisterObject(LinearEntity);
 
-        this->acceleration_ = Vector3::ZERO;
-        this->rotationAxis_ = Vector3::ZERO;
-        this->rotationRate_ = 0;
-        this->momentum_ = 0;
-
-        this->overwrite_position_ = Vector3::ZERO;
+        this->overwrite_position_    = Vector3::ZERO;
         this->overwrite_orientation_ = Quaternion::IDENTITY;
 
@@ -63,36 +58,10 @@
     {
         SUPER(LinearEntity, XMLPort, xmlelement, mode);
-
-        XMLPortParamTemplate(LinearEntity, "rotationaxis", setRotationAxis, getRotationAxis, xmlelement, mode, const Vector3&);
-        XMLPortParamTemplate(LinearEntity, "rotationrate", setRotationRate, getRotationRate, xmlelement, mode, const Degree&);
-    }
-
-    void LinearEntity::tick(float dt)
-    {
-        if (this->isActive())
-        {
-            if (!this->isDynamic())
-            {
-                // we have to do 'physics' ourselves.
-                this->velocity_ += (dt * this->acceleration_);
-                this->node_->translate(dt * this->velocity_);
-
-                this->rotationRate_ += (dt * this->momentum_);
-                this->node_->rotate(this->rotationAxis_, this->rotationRate_  * dt);
-            }
-        }
     }
 
     void LinearEntity::registerVariables()
     {
-        REGISTERDATA(this->velocity_.x, network::direction::toclient);
-        REGISTERDATA(this->velocity_.y, network::direction::toclient);
-        REGISTERDATA(this->velocity_.z, network::direction::toclient);
-
-        REGISTERDATA(this->rotationAxis_.x, network::direction::toclient);
-        REGISTERDATA(this->rotationAxis_.y, network::direction::toclient);
-        REGISTERDATA(this->rotationAxis_.z, network::direction::toclient);
-
-        REGISTERDATA(this->rotationRate_, network::direction::toclient);
+        REGISTERDATA(this->linearVelocity_,        network::direction::toclient, new network::NetworkCallback<LinearEntity>(this, &LinearEntity::processLinearVelocity));
+        REGISTERDATA(this->angularVelocity_,       network::direction::toclient, new network::NetworkCallback<LinearEntity>(this, &LinearEntity::processAngularVelocity));
 
         REGISTERDATA(this->overwrite_position_,    network::direction::toclient, new network::NetworkCallback<LinearEntity>(this, &LinearEntity::overwritePosition));
@@ -100,17 +69,29 @@
     }
 
+    void LinearEntity::tick(float dt)
+    {
+        MovableEntity::tick(dt);
+
+        if (this->isActive())
+        {
+        }
+    }
+
     void LinearEntity::overwritePosition()
     {
-        this->node_->setPosition(this->overwrite_position_);
+        //COUT(0) << "Setting position on client: " << this->overwrite_position_ << std::endl;
+        this->setPosition(this->overwrite_position_);
     }
 
     void LinearEntity::overwriteOrientation()
     {
-        this->node_->setOrientation(this->overwrite_orientation_);
+        //COUT(0) << "Setting orientation on client: " << this->overwrite_orientation_ << std::endl;
+        this->setOrientation(this->overwrite_orientation_);
     }
 
     void LinearEntity::clientConnected(unsigned int clientID)
     {
-        new Timer<LinearEntity>(rnd() * MAX_RESYNCHRONIZE_TIME, false, this, createExecutor(createFunctor(&LinearEntity::resynchronize)), true);
+        resynchronize();
+        new Timer<LinearEntity>(rnd() * MAX_RESYNCHRONIZE_TIME, true, this, createExecutor(createFunctor(&LinearEntity::resynchronize)), false);
     }
 
@@ -121,16 +102,26 @@
     void LinearEntity::resynchronize()
     {
-        this->overwrite_position_ = this->getPosition();
-        this->overwrite_orientation_ = this->getOrientation();
+        positionChanged(false);
+        orientationChanged(false);
     }
 
-    void LinearEntity::positionChanged()
+    void LinearEntity::positionChanged(bool bContinuous)
     {
-        this->overwrite_position_  = this->getPosition();
+        if (!bContinuous)
+        {
+            //if (Core::isMaster())
+            //    COUT(0) << "Setting position on server: " << this->getPosition() << std::endl;
+            this->overwrite_position_ = this->getPosition();
+        }
     }
 
-    void LinearEntity::orientationChanged()
+    void LinearEntity::orientationChanged(bool bContinuous)
     {
-        this->overwrite_orientation_  = this->getOrientation();
+        if (!bContinuous)
+        {
+            //if (Core::isMaster())
+            //    COUT(0) << "Setting orientation on server: " << this->getOrientation() << std::endl;
+            this->overwrite_orientation_ = this->getOrientation();
+        }
     }
 }
Index: code/branches/physics/src/orxonox/objects/worldentities/LinearEntity.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/LinearEntity.h	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/LinearEntity.h	(revision 2374)
@@ -33,10 +33,9 @@
 
 #include "MovableEntity.h"
-#include "objects/Tickable.h"
 #include "network/ClientConnectionListener.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport LinearEntity : public MovableEntity, public network::ClientConnectionListener, public Tickable
+    class _OrxonoxExport LinearEntity : public MovableEntity, public network::ClientConnectionListener
     {
         public:
@@ -48,32 +47,4 @@
             void registerVariables();
 
-            inline void setAcceleration(const Vector3& acceleration)
-                { this->acceleration_ = acceleration; }
-            inline void setAcceleration(float x, float y, float z)
-                { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
-            inline const Vector3& getAcceleration() const
-                { return this->acceleration_; }
-
-            inline void setRotationAxis(const Vector3& axis)
-                { this->rotationAxis_ = axis; this->rotationAxis_.normalise(); }
-            inline void setRotationAxis(float x, float y, float z)
-                { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; rotationAxis_.normalise(); }
-            inline const Vector3& getRotationAxis() const
-                { return this->rotationAxis_; }
-
-            inline void setRotationRate(const Degree& angle)
-                { this->rotationRate_ = angle; }
-            inline void setRotationRate(const Radian& angle)
-                { this->rotationRate_ = angle; }
-            inline const Degree& getRotationRate() const
-                { return this->rotationRate_; }
-
-            inline void setMomentum(const Degree& angle)
-                { this->momentum_ = angle; }
-            inline void setMomentum(const Radian& angle)
-                { this->momentum_ = angle; }
-            inline const Degree& getMomentum() const
-                { return this->momentum_; }
-
         private:
             void clientConnected(unsigned int clientID);
@@ -81,14 +52,14 @@
             void resynchronize();
 
+            inline void processLinearVelocity()
+                { this->setVelocity(this->linearVelocity_); }
+            inline void processAngularVelocity()
+                { this->setAngularVelocity(this->angularVelocity_); }
+
             void overwritePosition();
             void overwriteOrientation();
 
-            void positionChanged();
-            void orientationChanged();
-
-            Vector3 acceleration_;
-            Vector3 rotationAxis_;
-            Degree rotationRate_;
-            Degree momentum_;
+            void positionChanged(bool bContinuous);
+            void orientationChanged(bool bContinuous);
 
             Vector3 overwrite_position_;
Index: code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 2374)
@@ -33,4 +33,5 @@
 
 #include "util/Debug.h"
+#include "util/MathConvert.h"
 #include "util/Exception.h"
 #include "core/CoreIncludes.h"
@@ -45,5 +46,8 @@
         RegisterObject(MovableEntity);
 
-        this->velocity_ = Vector3::ZERO;
+        this->linearAcceleration_  = Vector3::ZERO;
+        this->linearVelocity_      = Vector3::ZERO;
+        this->angularAcceleration_ = Vector3::ZERO;
+        this->angularVelocity_     = Vector3::ZERO;
 
         this->registerVariables();
@@ -58,5 +62,7 @@
         SUPER(MovableEntity, XMLPort, xmlelement, mode);
 
-        XMLPortParamTemplate(MovableEntity, "velocity", setVelocity, getVelocity, xmlelement, mode, const Vector3&);
+        XMLPortParamTemplate(MovableEntity, "velocity",     setVelocity,     getVelocity,     xmlelement, mode, const Vector3&);
+        XMLPortParamTemplate(MovableEntity, "rotationaxis", setRotationAxis, getRotationAxis, xmlelement, mode, const Vector3&);
+        XMLPortParam(MovableEntity, "rotationrate", setRotationRate, getRotationRate, xmlelement, mode);
     }
 
@@ -65,8 +71,43 @@
     }
 
+    void MovableEntity::tick(float dt)
+    {
+        if (this->isActive())
+        {
+            // Check whether Bullet doesn't do the physics for us
+            if (!this->isDynamic())
+            {
+                // Linear part
+                this->linearVelocity_.x += this->linearAcceleration_.x * dt;
+                this->linearVelocity_.y += this->linearAcceleration_.y * dt;
+                this->linearVelocity_.z += this->linearAcceleration_.z * dt;
+                linearVelocityChanged(true);
+                this->node_->translate(this->linearVelocity_ * dt);
+                positionChanged(true);
+
+                // Angular part
+                // Note: angularVelocity_ is a Quaternion with w = 0 while angularAcceleration_ is a Vector3
+                this->angularVelocity_.x += angularAcceleration_.x * dt;
+                this->angularVelocity_.y += angularAcceleration_.y * dt;
+                this->angularVelocity_.z += angularAcceleration_.z * dt;
+                angularVelocityChanged(true);
+                // Calculate new orientation with quaternion derivative. This is about 30% faster than with angle/axis method.
+                float mult = dt * 0.5;
+                // TODO: this could be optimized by writing it out. The calls currently create 4 new Quaternions!
+                Quaternion newOrientation(0.0f, this->angularVelocity_.x * mult, this->angularVelocity_.y * mult, this->angularVelocity_.z * mult);
+                newOrientation = this->node_->getOrientation() + newOrientation * this->node_->getOrientation();
+                newOrientation.normalise();
+                this->node_->setOrientation(newOrientation);
+                orientationChanged(true);
+            }
+        }
+    }
+
     void MovableEntity::setPosition(const Vector3& position)
     {
         if (this->isDynamic())
         {
+            //if (this->isPhysicsRunning())
+            //    return;
             btTransform transf = this->physicalBody_->getWorldTransform();
             transf.setOrigin(btVector3(position.x, position.y, position.z));
@@ -74,6 +115,7 @@
         }
 
+        //COUT(0) << "setting position: " << position << std::endl;
         this->node_->setPosition(position);
-        positionChanged();
+        positionChanged(false);
     }
 
@@ -88,5 +130,5 @@
 
         this->node_->translate(distance, relativeTo);
-        positionChanged();
+        positionChanged(false);
     }
 
@@ -96,10 +138,10 @@
         {
             btTransform transf = this->physicalBody_->getWorldTransform();
-            transf.setRotation(btQuaternion(orientation.w, orientation.x, orientation.y, orientation.z));
+            transf.setRotation(btQuaternion(orientation.x, orientation.y, orientation.z, orientation.w));
             this->physicalBody_->setWorldTransform(transf);
         }
 
         this->node_->setOrientation(orientation);
-        orientationChanged();
+        orientationChanged(false);
     }
 
@@ -111,9 +153,9 @@
                                                           to any other space than TS_LOCAL.");
             btTransform transf = this->physicalBody_->getWorldTransform();
-            this->physicalBody_->setWorldTransform(transf * btTransform(btQuaternion(rotation.w, rotation.x, rotation.y, rotation.z)));
+            this->physicalBody_->setWorldTransform(transf * btTransform(btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w)));
         }
 
         this->node_->rotate(rotation, relativeTo);
-        orientationChanged();
+        orientationChanged(false);
     }
 
@@ -130,5 +172,5 @@
 
         this->node_->yaw(angle, relativeTo);
-        orientationChanged();
+        orientationChanged(false);
     }
 
@@ -145,5 +187,5 @@
 
         this->node_->pitch(angle, relativeTo);
-        orientationChanged();
+        orientationChanged(false);
     }
 
@@ -160,5 +202,5 @@
 
         this->node_->roll(angle, relativeTo);
-        orientationChanged();
+        orientationChanged(false);
     }
 
@@ -175,5 +217,5 @@
 
         this->node_->lookAt(target, relativeTo, localDirectionVector);
-        orientationChanged();
+        orientationChanged(false);
     }
 
@@ -190,5 +232,5 @@
 
         this->node_->setDirection(direction, relativeTo, localDirectionVector);
-        orientationChanged();
+        orientationChanged(false);
     }
 
@@ -196,10 +238,36 @@
     {
         if (this->isDynamic())
-        {
             this->physicalBody_->setLinearVelocity(btVector3(velocity.x, velocity.y, velocity.z));
-        }
-
-        this->velocity_ = velocity;
-        velocityChanged();
+
+        this->linearVelocity_ = velocity;
+        linearVelocityChanged(false);
+    }
+
+    void MovableEntity::setAngularVelocity(const Vector3& velocity)
+    {
+        if (this->isDynamic())
+            this->physicalBody_->setAngularVelocity(btVector3(velocity.x, velocity.y, velocity.z));
+
+        this->angularVelocity_ = velocity;
+        angularVelocityChanged(false);
+    }
+
+    void MovableEntity::setAcceleration(const Vector3& acceleration)
+    {
+        if (this->isDynamic())
+            this->physicalBody_->applyCentralForce(btVector3(acceleration.x * this->getMass(), acceleration.y * this->getMass(), acceleration.z * this->getMass()));
+
+        this->linearAcceleration_ = acceleration;
+    }
+
+    void MovableEntity::setAngularAcceleration(const Vector3& acceleration)
+    {
+        if (this->isDynamic())
+        {
+            btVector3 inertia(btVector3(1, 1, 1) / this->physicalBody_->getInvInertiaDiagLocal());
+            this->physicalBody_->applyTorque(btVector3(acceleration.x, acceleration.y, acceleration.z) * inertia);
+        }
+
+        this->angularAcceleration_ = acceleration;
     }
 
@@ -220,23 +288,28 @@
         this->node_->setPosition(Vector3(worldTrans.getOrigin().x(), worldTrans.getOrigin().y(), worldTrans.getOrigin().z()));
         this->node_->setOrientation(Quaternion(worldTrans.getRotation().w(), worldTrans.getRotation().x(), worldTrans.getRotation().y(), worldTrans.getRotation().z()));
-        const btVector3& velocity = this->physicalBody_->getLinearVelocity();
-        this->velocity_.x = velocity.x();
-        this->velocity_.y = velocity.y();
-        this->velocity_.z = velocity.z();
-        velocityChanged();
-        positionChanged();
-        orientationChanged();
+        COUT(0) << "setting world transform: " << omni_cast<std::string>(node_->getPosition()) << std::endl;
+        this->linearVelocity_.x = this->physicalBody_->getLinearVelocity().x();
+        this->linearVelocity_.y = this->physicalBody_->getLinearVelocity().y();
+        this->linearVelocity_.z = this->physicalBody_->getLinearVelocity().z();
+        this->angularVelocity_.x = this->physicalBody_->getAngularVelocity().x();
+        this->angularVelocity_.y = this->physicalBody_->getAngularVelocity().y();
+        this->angularVelocity_.z = this->physicalBody_->getAngularVelocity().z();
+        linearVelocityChanged(true);
+        angularVelocityChanged(true);
+        positionChanged(true);
+        orientationChanged(true);
     }
 
     void MovableEntity::getWorldTransform(btTransform& worldTrans) const
     {
-        // We use a kinematic body 
+        // We use a kinematic body
         worldTrans.setOrigin(btVector3(node_->getPosition().x, node_->getPosition().y, node_->getPosition().z));
-        worldTrans.setRotation(btQuaternion(node_->getOrientation().w, node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z));
+        worldTrans.setRotation(btQuaternion(node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z, node_->getOrientation().w));
         if (this->isDynamic())
         {
             // This function gets called only once for dynamic objects to set the initial conditions
-            // We have to set the velocity too.
-            this->physicalBody_->setLinearVelocity(btVector3(velocity_.x, velocity_.y, velocity_.z));
+            // We have to set the velocities too.
+            this->physicalBody_->setLinearVelocity(btVector3(linearVelocity_.x, linearVelocity_.y, linearVelocity_.z));
+            this->physicalBody_->setAngularVelocity(btVector3(angularVelocity_.x, angularVelocity_.y, angularVelocity_.z));
         }
     }
Index: code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.h	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.h	(revision 2374)
@@ -34,9 +34,8 @@
 #include "WorldEntity.h"
 #include "objects/Tickable.h"
-#include "network/ClientConnectionListener.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport MovableEntity : public WorldEntity
+    class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable
     {
         public:
@@ -45,4 +44,5 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            virtual void tick(float dt);
             void registerVariables();
 
@@ -69,17 +69,47 @@
             void setVelocity(const Vector3& velocity);
             inline void setVelocity(float x, float y, float z)
-                { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
+                { this->setVelocity(Vector3(x, y, z)); }
             inline const Vector3& getVelocity() const
-                { return this->velocity_; }
+                { return this->linearVelocity_; }
+
+            void setAngularVelocity(const Vector3& velocity);
+            inline void setAngularVelocity(float x, float y, float z)
+                { this->setAngularVelocity(Vector3(x, y, z)); }
+            inline const Vector3& getAngularVelocity() const
+                { return this->linearAcceleration_; }
+
+            void setAcceleration(const Vector3& acceleration);
+            inline void setAcceleration(float x, float y, float z)
+                { this->setAcceleration(Vector3(x, y, z)); }
+            inline const Vector3& getAcceleration() const
+                { return this->linearAcceleration_; }
+
+            void setAngularAcceleration(const Vector3& acceleration);
+            inline void setAngularAcceleration(float x, float y, float z)
+                { this->setAngularAcceleration(Vector3(x, y, z)); }
+            inline const Vector3& getAngularAcceleration() const
+                { return this->angularAcceleration_; }
+
+            inline void setRotationRate(Degree rate)
+                { this->setAngularVelocity(this->getAngularVelocity().normalisedCopy() * rate.valueRadians()); }
+            inline Degree getRotationRate() const
+                { return Degree(this->getAngularVelocity().length()); }
+
+            inline void setRotationAxis(const Vector3& axis)
+                { this->setAngularVelocity(axis * this->getAngularVelocity().length()); }
+            inline Vector3 getRotationAxis() const
+                { return this->getAngularVelocity().normalisedCopy(); }
 
         protected:
-            Vector3 velocity_;
+            Vector3 linearAcceleration_;
+            Vector3 linearVelocity_;
+            Vector3 angularAcceleration_;
+            Vector3 angularVelocity_;
 
         private:
-            //void attachPhysicalObject(WorldEntity* object);
-
-            virtual void positionChanged() { }
-            virtual void orientationChanged() { }
-            virtual void velocityChanged() { }
+            virtual void positionChanged       (bool bContinuous) { }
+            virtual void orientationChanged    (bool bContinuous) { }
+            virtual void linearVelocityChanged (bool bContinuous) { }
+            virtual void angularVelocityChanged(bool bContinuous) { }
 
             virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
Index: code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.cc	(revision 2374)
@@ -31,4 +31,6 @@
 #include "StaticEntity.h"
 
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
 #include "util/Exception.h"
 #include "core/CoreIncludes.h"
@@ -51,12 +53,140 @@
     void StaticEntity::registerVariables()
     {
-        REGISTERDATA(this->getPosition().x, network::direction::toclient);
-        REGISTERDATA(this->getPosition().y, network::direction::toclient);
-        REGISTERDATA(this->getPosition().z, network::direction::toclient);
-
-        REGISTERDATA(this->getOrientation().w, network::direction::toclient);
-        REGISTERDATA(this->getOrientation().x, network::direction::toclient);
-        REGISTERDATA(this->getOrientation().y, network::direction::toclient);
-        REGISTERDATA(this->getOrientation().z, network::direction::toclient);
+        REGISTERDATA(this->getPosition(),    network::direction::toclient, new network::NetworkCallback<StaticEntity>(this, &StaticEntity::positionChanged));
+        REGISTERDATA(this->getOrientation(), network::direction::toclient, new network::NetworkCallback<StaticEntity>(this, &StaticEntity::orientationChanged));
+    }
+
+
+    void StaticEntity::setPosition(const Vector3& position)
+    {
+        if (this->isPhysicsRunning())
+            ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");
+        if (this->isStatic())
+        {
+            btTransform transf = this->physicalBody_->getWorldTransform();
+            transf.setOrigin(btVector3(position.x, position.y, position.z));
+            this->physicalBody_->setWorldTransform(transf);
+        }
+
+        this->node_->setPosition(position);
+    }
+
+    void StaticEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)
+    {
+        if (this->isPhysicsRunning())
+            ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");
+        if (this->isStatic())
+        {
+            OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot translate physical object relative \
+                                                          to any other space than TS_LOCAL.");
+            this->physicalBody_->translate(btVector3(distance.x, distance.y, distance.z));
+        }
+
+        this->node_->translate(distance, relativeTo);
+    }
+
+    void StaticEntity::setOrientation(const Quaternion& orientation)
+    {
+        if (this->isPhysicsRunning())
+            ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");
+        if (this->isStatic())
+        {
+            btTransform transf = this->physicalBody_->getWorldTransform();
+            transf.setRotation(btQuaternion(orientation.x, orientation.y, orientation.z, orientation.w));
+            this->physicalBody_->setWorldTransform(transf);
+        }
+
+        this->node_->setOrientation(orientation);
+    }
+
+    void StaticEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)
+    {
+        if (this->isPhysicsRunning())
+            ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");
+        if (this->isStatic())
+        {
+            OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot rotate physical object relative \
+                                                          to any other space than TS_LOCAL.");
+            btTransform transf = this->physicalBody_->getWorldTransform();
+            this->physicalBody_->setWorldTransform(transf * btTransform(btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w)));
+        }
+
+        this->node_->rotate(rotation, relativeTo);
+    }
+
+    void StaticEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
+    {
+        if (this->isPhysicsRunning())
+            ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");
+        if (this->isStatic())
+        {
+            OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot yaw physical object relative \
+                                                          to any other space than TS_LOCAL.");
+            btTransform transf = this->physicalBody_->getWorldTransform();
+            btTransform rotation(btQuaternion(angle.valueRadians(), 0.0f, 0.0f));
+            this->physicalBody_->setWorldTransform(transf * rotation);
+        }
+
+        this->node_->yaw(angle, relativeTo);
+    }
+
+    void StaticEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
+    {
+        if (this->isPhysicsRunning())
+            ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");
+        if (this->isStatic())
+        {
+            OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot pitch physical object relative \
+                                                          to any other space than TS_LOCAL.");
+            btTransform transf = this->physicalBody_->getWorldTransform();
+            btTransform rotation(btQuaternion(0.0f, angle.valueRadians(), 0.0f));
+            this->physicalBody_->setWorldTransform(transf * rotation);
+        }
+
+        this->node_->pitch(angle, relativeTo);
+    }
+
+    void StaticEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
+    {
+        if (this->isPhysicsRunning())
+            ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");
+        if (this->isStatic())
+        {
+            OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot roll physical object relative \
+                                                          to any other space than TS_LOCAL.");
+            btTransform transf = this->physicalBody_->getWorldTransform();
+            btTransform rotation(btQuaternion(angle.valueRadians(), 0.0f, 0.0f));
+            this->physicalBody_->setWorldTransform(transf * rotation);
+        }
+
+        this->node_->roll(angle, relativeTo);
+    }
+
+    void StaticEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
+    {
+        if (this->isPhysicsRunning())
+            ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");
+        if (this->isStatic())
+        {
+            ThrowException(NotImplemented, "ControllableEntity::lookAt() is not yet supported for physical objects.");
+            OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot align physical object relative \
+                                                          to any other space than TS_LOCAL.");
+        }
+
+        this->node_->lookAt(target, relativeTo, localDirectionVector);
+    }
+
+    void StaticEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
+    {
+        if (this->isPhysicsRunning())
+            ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");
+        if (this->isStatic())
+        {
+            ThrowException(NotImplemented, "ControllableEntity::setDirection() is not yet supported for physical objects.");
+            OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot align physical object relative \
+                                                          to any other space than TS_LOCAL.");
+        }
+
+        this->node_->setDirection(direction, relativeTo, localDirectionVector);
     }
 
@@ -81,5 +211,5 @@
     {
         worldTrans.setOrigin(btVector3(node_->getPosition().x, node_->getPosition().y, node_->getPosition().z));
-        worldTrans.setRotation(btQuaternion(node_->getOrientation().w, node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z));
+        worldTrans.setRotation(btQuaternion(node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z, node_->getOrientation().w));
     }
 }
Index: code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.h	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.h	(revision 2374)
@@ -54,26 +54,21 @@
             using WorldEntity::setDirection;
 
-            inline void setPosition(const Vector3& position)
-                { this->node_->setPosition(position); }
-            inline void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->node_->translate(distance, relativeTo); }
-            inline void setOrientation(const Quaternion& orientation)
-                { this->node_->setOrientation(orientation); }
-            inline void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->node_->rotate(rotation, relativeTo); }
-            inline void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->node_->yaw(angle, relativeTo); }
-            inline void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->node_->pitch(angle, relativeTo); }
-            inline void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)
-                { this->node_->roll(angle, relativeTo); }
-            inline void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
-                { this->node_->lookAt(target, relativeTo, localDirectionVector); }
-            inline void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
-                { this->node_->setDirection(direction, relativeTo, localDirectionVector); }
+            void setPosition(const Vector3& position);
+            void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void setOrientation(const Quaternion& orientation);
+            void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
+            void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
+            void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
 
         private:
+            bool isCollisionTypeLegal(CollisionType type) const;
 
-            bool isCollisionTypeLegal(CollisionType type) const;
+            inline void positionChanged()
+                { this->setPosition(this->getPosition()); }
+            inline void orientationChanged()
+                { this->setOrientation(this->getOrientation()); }
 
             // Bullet btMotionState related
Index: code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 2374)
@@ -14,5 +14,5 @@
  *   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.
+ *   GNU General Public License for more details. 
  *
  *   You should have received a copy of the GNU General Public License
@@ -73,8 +73,9 @@
         // Default behaviour does not include physics
         this->physicalBody_ = 0;
-        this->collisionShape_ = 0;
+        this->collisionShape_ = new CompoundCollisionShape(this);
         this->mass_ = 0;
         this->childMass_ = 0;
         this->collisionType_ = None;
+        this->collisionTypeSynchronised_ = None;
 
         this->registerVariables();
@@ -113,9 +114,11 @@
         XMLPortParam(WorldEntity, "scale", setScale, getScale, xmlelement, mode);
 
+        // Physics
         XMLPortParam(WorldEntity, "collisionType", setCollisionTypeStr, getCollisionTypeStr, xmlelement, mode);
-        //XMLPortParam(WorldEntity, "collisionRadius", setCollisionRadius, getCollisionRadius, xmlelement, mode);
         XMLPortParam(WorldEntity, "mass", setMass, getMass, xmlelement, mode);
 
+        // Other attached WorldEntities
         XMLPortObject(WorldEntity, WorldEntity, "attached", attach, getAttachedObject, xmlelement, mode);
+        // Attached collision shapes
         XMLPortObject(WorldEntity, CollisionShape, "collisionShapes", attachCollisionShape, getAttachedCollisionShape, xmlelement, mode);
     }
@@ -123,10 +126,13 @@
     void WorldEntity::registerVariables()
     {
-        REGISTERDATA(this->bActive_,  network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));
-        REGISTERDATA(this->bVisible_, network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));
-
-        REGISTERDATA(this->getScale3D().x, network::direction::toclient);
-        REGISTERDATA(this->getScale3D().y, network::direction::toclient);
-        REGISTERDATA(this->getScale3D().z, network::direction::toclient);
+        REGISTERDATA(this->bActive_,     network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));
+        REGISTERDATA(this->bVisible_,    network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));
+
+        // HACK: Removed the call because it gets called the first time as well
+        REGISTERDATA(this->getScale3D(), network::direction::toclient);//, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::scaleChanged));
+
+        int* collisionType = (int*)&this->collisionTypeSynchronised_;
+        REGISTERDATA(*collisionType, network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::collisionTypeChanged));
+        REGISTERDATA(this->mass_,    network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::massChanged));
 
         REGISTERDATA(this->parentID_, network::direction::toclient, new network::NetworkCallback<WorldEntity>(this, &WorldEntity::updateParent));
@@ -138,4 +144,27 @@
         if (parent)
             this->attachToParent(parent);
+    }
+
+    void WorldEntity::collisionTypeChanged()
+    {
+        if (this->collisionTypeSynchronised_ != Dynamic &&
+            this->collisionTypeSynchronised_ != Kinematic &&
+            this->collisionTypeSynchronised_ != Static &&
+            this->collisionTypeSynchronised_ != None)
+        {
+            CCOUT(1) << "Error when collsion Type was received over network. Unknown enum value:" << this->collisionTypeSynchronised_ << std::endl;
+        }
+        else if (this->collisionTypeSynchronised_ != collisionType_)
+        {
+            if (this->parent_)
+                CCOUT(2) << "Warning: Network connection tried to set the collision type of an attached WE. Ignoring." << std::endl;
+            else
+                this->setCollisionType(this->collisionTypeSynchronised_);
+        }
+    }
+
+    void WorldEntity::massChanged()
+    {
+        this->setMass(this->mass_);
     }
 
@@ -210,27 +239,5 @@
     void WorldEntity::attachCollisionShape(CollisionShape* shape)
     {
-        this->attachedShapes_.push_back(shape);
-
-        if (!this->collisionShape_ && shape->hasNoTransform())
-        {
-            // Set local scaling right when adding it. It can include both scaling parameters
-            // and shape parameters (like sphere radius)
-            shape->getCollisionShape()->setLocalScaling(shape->getTotalScaling());
-            this->collisionShape_ = shape;
-            // recalculate inertia tensor
-            if (this->isDynamic())
-                internalSetMassProps();
-        }
-        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);
-        }
+        this->collisionShape_->addChildShape(shape);
 
         if (this->physicalBody_)
@@ -241,31 +248,15 @@
                 removeFromPhysicalWorld();
             }
-            this->physicalBody_->setCollisionShape(this->collisionShape_->getCollisionShape());
-        }
-
-        addToPhysicalWorld();
+            if (this->collisionShape_->getCollisionShape())
+                this->physicalBody_->setCollisionShape(this->collisionShape_->getCollisionShape());
+            // recalculate inertia tensor
+            internalSetMassProps();
+            addToPhysicalWorld();
+        }
     }
 
     CollisionShape* WorldEntity::getAttachedCollisionShape(unsigned int index) const
     {
-        if (index < this->attachedShapes_.size())
-            return attachedShapes_[index];
-        else
-            return 0;
-    }
-
-    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);
-
-        // recalculate inertia tensor
-        internalSetMassProps();
+        return this->collisionShape_->getChildShape(index);
     }
 
@@ -302,5 +293,7 @@
         this->mass_ = mass;
         if (!this->hasPhysics())
-            COUT(3) << "Warning: Setting the mass of a WorldEntity with no physics has no effect." << std::endl;
+            return;
+        // TODO: Add this again when new network callbacks work properly
+            //COUT(3) << "Warning: Setting the mass of a WorldEntity with no physics has no effect." << std::endl;
         else
         {
@@ -320,12 +313,13 @@
         assert(hasPhysics());
 
-        if ((this->isKinematic() || this->isStatic()) && (this->mass_ + this->childMass_) != 0.0f)
-        {
-            // Mass non zero is a bad idea for kinematic and static objects
+        if (this->isStatic())
+        {
+            // Just set everything to zero
             this->physicalBody_->setMassProps(0.0f, btVector3(0, 0, 0));
         }
-        else if (this->isDynamic() && (this->mass_ + this->childMass_) == 0.0f)
-        {
-            // Mass zero is not such a good idea for dynamic objects
+        else if ((this->mass_ + this->childMass_) == 0.0f)
+        {
+            // Use default values to avoid very large or very small values
+            CCOUT(2) << "Warning: Setting the internal physical mass to 1.0 because mass_ is 0.0." << std::endl;
             this->physicalBody_->setMassProps(1.0f, this->getLocalInertia(1.0f));
         }
@@ -337,5 +331,5 @@
     {
         btVector3 inertia(0, 0, 0);
-        if (this->collisionShape_)
+        if (this->collisionShape_->getCollisionShape())
             this->collisionShape_->getCollisionShape()->calculateLocalInertia(mass, inertia);
         return inertia;
@@ -368,4 +362,5 @@
             this->physicalBody_ = new btRigidBody(bodyConstructionInfo);
             this->physicalBody_->setUserPointer(this);
+            this->physicalBody_->setActivationState(DISABLE_DEACTIVATION);
         }
         else if (type == None && this->collisionType_ != None)
@@ -377,4 +372,5 @@
             this->physicalBody_ = 0;
             this->collisionType_ = None;
+            this->collisionTypeSynchronised_ = None;
             return;
         }
@@ -401,5 +397,5 @@
 
         // update mass and inertia tensor
-        internalSetMassProps(); // type is not None! See case None: in switch
+        internalSetMassProps(); // type is not None! See case None in switch
 
         addToPhysicalWorld();
@@ -451,4 +447,10 @@
         else
             this->collisionType_ = Dynamic;
+        this->collisionTypeSynchronised_ = this->collisionType_;
+    }
+
+    bool WorldEntity::isPhysicsRunning() const
+    {
+        return this->physicalBody_ && this->physicalBody_->isInWorld();
     }
 
Index: code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h	(revision 2374)
@@ -164,4 +164,7 @@
                 { this->roll(angle); }
 
+            inline void scaleChanged()
+                { this->setScale3D(this->getScale3D()); }
+
             WorldEntity* parent_;
             unsigned int parentID_;
@@ -186,4 +189,5 @@
             bool isKinematic() const { return getCollisionType() == Kinematic; }
             bool isDynamic()   const { return getCollisionType() == Dynamic  ; }
+            bool isPhysicsRunning() const;
 
             inline CollisionType getCollisionType() const
@@ -201,5 +205,5 @@
             CollisionShape* getAttachedCollisionShape(unsigned int index) const;
 
-            inline CollisionShape* getCollisionShape()
+            inline CompoundCollisionShape* getCollisionShape()
                 { return this->collisionShape_; }
             inline btRigidBody* getPhysicalBody()
@@ -220,7 +224,11 @@
             void removeFromPhysicalWorld() const;
 
+            // network callbacks
+            void collisionTypeChanged();
+            void massChanged();
+
             CollisionType                collisionType_;
-            std::vector<CollisionShape*> attachedShapes_;
-            CollisionShape*              collisionShape_;
+            CollisionType                collisionTypeSynchronised_;
+            CompoundCollisionShape*      collisionShape_;
             btScalar                     mass_;
             btScalar                     childMass_;
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.cc	(revision 2374)
@@ -37,13 +37,19 @@
 #include "tools/BulletConversions.h"
 
+#include "CompoundCollisionShape.h"
+
 namespace orxonox
 {
     CreateFactory(CollisionShape);
 
-    CollisionShape::CollisionShape(BaseObject* creator) : StaticEntity(creator)
+    CollisionShape::CollisionShape(BaseObject* creator)
+        : BaseObject(creator)
+        , network::Synchronisable(creator)
     {
         RegisterObject(CollisionShape);
 
-        this->bIsCompound_ = false;
+        this->parent_ = 0;
+        this->parentID_ = (unsigned int)-1;
+        this->collisionShape_ = 0;
     }
 
@@ -55,26 +61,30 @@
     {
         SUPER(CollisionShape, XMLPort, xmlelement, mode);
+
+        XMLPortParamTemplate(CollisionShape, "position", setPosition, getPosition, xmlelement, mode, const Vector3&);
+        XMLPortParamTemplate(CollisionShape, "orientation", setOrientation, getOrientation, xmlelement, mode, const Quaternion&);
+        XMLPortParamLoadOnly(CollisionShape, "yaw",   yaw,   xmlelement, mode);
+        XMLPortParamLoadOnly(CollisionShape, "pitch", pitch, xmlelement, mode);
+        XMLPortParamLoadOnly(CollisionShape, "roll",  roll,  xmlelement, mode);
+        XMLPortParamTemplate(CollisionShape, "scale3D", setScale3D, getScale3D, xmlelement, mode, const Vector3&);
+        XMLPortParamLoadOnly(CollisionShape, "scale", setScale, xmlelement, mode);
     }
 
-    bool CollisionShape::isCollisionTypeLegal(WorldEntity::CollisionType type) const
+    void CollisionShape::registerVariables()
     {
-        if (type != WorldEntity::None)
-        {
-            ThrowException(PhysicsViolation, "A CollisionShape can only have CollisionType 'None'.");
-            return false;
-        }
-        else
-            return true;
+        REGISTERDATA(this->parentID_, network::direction::toclient, new network::NetworkCallback<CollisionShape>(this, &CollisionShape::updateParent));
     }
 
-    bool CollisionShape::hasNoTransform() const
+    void CollisionShape::updateParent()
     {
-        return (this->getPosition().positionEquals(Vector3(0, 0, 0), 0.001) &&
-                this->getOrientation().equals(Quaternion(1,0,0,0), Degree(0.1)));
+        CompoundCollisionShape* parent = dynamic_cast<CompoundCollisionShape*>(Synchronisable::getSynchronisable(this->parentID_));
+        if (parent)
+            parent->addChildShape(this);
     }
 
-    btVector3 CollisionShape::getTotalScaling()
+    bool CollisionShape::hasTransform() const
     {
-        return omni_cast<btVector3>(this->node_->getScale());
+        return (!this->position_.positionEquals(Vector3(0, 0, 0), 0.001) ||
+                !this->orientation_.equals(Quaternion(1,0,0,0), Degree(0.1)));
     }
 
@@ -84,5 +94,5 @@
     }
 
-    void CollisionShape::scale3D(const Vector3& scale)
+    void CollisionShape::setScale(float scale)
     {
         ThrowException(NotImplemented, "Cannot set the scale of a collision shape: Not yet implemented.");
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.h	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CollisionShape.h	(revision 2374)
@@ -32,9 +32,10 @@
 #include "OrxonoxPrereqs.h"
 
-#include "objects/worldentities/StaticEntity.h"
+#include "util/Math.h"
+#include "core/BaseObject.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport CollisionShape : public StaticEntity
+    class _OrxonoxExport CollisionShape : public BaseObject, public network::Synchronisable
     {
         public:
@@ -43,20 +44,44 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            void registerVariables();
 
-            btCollisionShape* getCollisionShape() const { return this->collisionShape_; }
-            bool isCompoundShape() const { return this->bIsCompound_; }
+            inline void setPosition(const Vector3& position)
+                { this->position_ = position; }
+            inline const Vector3& getPosition() const
+                { return this->position_; }
 
-            bool hasNoTransform() const;
-            virtual btVector3 getTotalScaling();
+            inline void setOrientation(const Quaternion& orientation)
+                { this->orientation_ = orientation; }
+            inline const Quaternion& getOrientation() const
+                { return this->orientation_; }
+
+            void yaw(const Degree& angle)   { this->orientation_ = this->orientation_ * Quaternion(angle, Vector3::UNIT_Y); }
+            void pitch(const Degree& angle) { this->orientation_ = this->orientation_ * Quaternion(angle, Vector3::UNIT_X); }
+            void roll(const Degree& angle)  { this->orientation_ = this->orientation_ * Quaternion(angle, Vector3::UNIT_Z); }
+
+            virtual void setScale3D(const Vector3& scale);
+            virtual void setScale(float scale);
+            inline const Vector3& getScale3D(void) const
+                { return this->scale_; }
+
+            virtual inline btCollisionShape* getCollisionShape() const
+                { return this->collisionShape_; }
+
+            bool hasTransform() const;
+
+            inline void setParent(CompoundCollisionShape* shape, unsigned int ID)
+                { this->parent_ = shape; this->parentID_ = ID; }
 
         protected:
-            bool              bIsCompound_;
             btCollisionShape* collisionShape_;
 
         private:
-            virtual void setScale3D(const Vector3& scale);
-            virtual void scale3D(const Vector3& scale);
+            void updateParent();
 
-            bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
+            Vector3           position_;
+            Quaternion        orientation_;
+            Vector3           scale_;
+            CompoundCollisionShape* parent_;
+            unsigned int      parentID_;
     };
 }
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.cc	(revision 2374)
@@ -44,7 +44,6 @@
         RegisterObject(CompoundCollisionShape);
 
-        this->bIsCompound_    = true;
+        this->collisionShape_ = 0;
         this->compoundShape_  = new btCompoundShape();
-        this->collisionShape_ = this->compoundShape_;
     }
 
@@ -58,14 +57,41 @@
     {
         SUPER(CompoundCollisionShape, XMLPort, xmlelement, mode);
+        // Attached collision shapes
+        XMLPortObject(CompoundCollisionShape, CollisionShape, "", addChildShape, getChildShape, xmlelement, mode);
+    }
 
-        XMLPortObject(CompoundCollisionShape, CollisionShape, "", addChildShape, getChildShape, xmlelement, mode);
+    btCollisionShape* CompoundCollisionShape::getCollisionShape() const
+    {
+        // Note: Returning collisionShape_ means that it's the only one and has no transform.
+        //       So we can get rid of the additional overhead with the compound shape.
+        if (this->collisionShape_)
+            return this->collisionShape_;
+        else if (this->childShapes_.size() != 0)
+            return this->compoundShape_;
+        else
+            return 0;
     }
 
     void CompoundCollisionShape::addChildShape(CollisionShape* shape)
     {
-        this->childShapes_.push_back(shape);
+        if (!shape || !shape->getCollisionShape())
+            return;
+        assert(this->compoundShape_);
         btTransform transf(omni_cast<btQuaternion>(shape->getOrientation()), omni_cast<btVector3>(shape->getPosition()));
-        shape->getCollisionShape()->setLocalScaling(shape->getTotalScaling());
         this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
+
+        if (this->childShapes_.size() == 1 && this->childShapes_[0] && !this->childShapes_[0]->hasTransform())
+        {
+            // --> Only shape to be added, no transform; add it directly
+            this->collisionShape_ = shape->getCollisionShape();
+        }
+        else
+        {
+            // Make sure we use the compound shape
+            this->collisionShape_ = 0;
+        }
+
+        // network synchro
+        shape->setParent(this, this->getObjectID());
     }
 
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.h	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/CompoundCollisionShape.h	(revision 2374)
@@ -48,4 +48,6 @@
             CollisionShape* getChildShape(unsigned int index) const;
 
+            virtual btCollisionShape* getCollisionShape() const;
+
         private:
             btCompoundShape* compoundShape_;
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/PlaneCollisionShape.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/PlaneCollisionShape.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/PlaneCollisionShape.cc	(revision 2374)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Reto Grieder
+ *      Martin Stypinski
  *   Co-authors:
  *      ...
@@ -30,7 +30,4 @@
 #include "PlaneCollisionShape.h"
 
-#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
-
-#include "tools/BulletConversions.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
@@ -45,6 +42,8 @@
         RegisterObject(PlaneCollisionShape);
 
-        this->planeShape_ = new btStaticPlaneShape(btVector3(1,1,1), 0);
+        this->planeShape_ = new btStaticPlaneShape(btVector3(1, 1, 1), 0);
         this->collisionShape_ = this->planeShape_;
+        this->planeNormal_ = Vector3(1, 1, 1);
+        this->planeOffset_ = 0.0f;
     }
 
@@ -52,21 +51,11 @@
     {
         if (this->isInitialized())
-            delete this->collisionShape_;
+            delete this->planeShape_;
     }
 
-    void PlaneCollisionShape::setNormal(const Vector3& normal)
+    void PlaneCollisionShape::registerVariables()
     {
-        btScalar offset = this->planeShape_->getPlaneConstant();
-        delete this->collisionShape_;
-        this->planeShape_ = new btStaticPlaneShape(omni_cast<btVector3>(normal), offset);
-        this->collisionShape_ = this->planeShape_;
-    }
-
-    void PlaneCollisionShape::setOffset(float offset)
-    {
-        btVector3 normal = this->planeShape_->getPlaneNormal();
-        delete this->collisionShape_;
-        this->planeShape_ = new btStaticPlaneShape(normal, offset);
-        this->collisionShape_ = this ->planeShape_;
+        REGISTERDATA(this->planeNormal_, network::direction::toclient, new network::NetworkCallback<PlaneCollisionShape>(this, &PlaneCollisionShape::planeNormalChanged));
+        REGISTERDATA(this->planeOffset_, network::direction::toclient, new network::NetworkCallback<PlaneCollisionShape>(this, &PlaneCollisionShape::planeOffsetChanged));
     }
 
@@ -75,11 +64,22 @@
         SUPER(PlaneCollisionShape, XMLPort, xmlelement, mode);
 
-        XMLPortParam(PlaneCollisionShape, "normal", setNormal, getNormal, xmlelement, mode);
-        XMLPortParam(PlaneCollisionShape, "offset", setOffset, getOffset, xmlelement, mode);    
+        XMLPortParam(PlaneCollisionShape, "planeNormal", setNormal, getNormal, xmlelement, mode);
+        XMLPortParam(PlaneCollisionShape, "planeOffset", setOffset, getOffset, xmlelement, mode);    
     }
 
-    btVector3 PlaneCollisionShape::getTotalScaling()
+    void PlaneCollisionShape::setNormal(const Vector3& normal)
     {
-        return omni_cast<btVector3>(this->node_->getScale()); //* this->radius_;
+        delete this->planeShape_;
+        this->planeNormal_ = normal;
+        this->planeShape_ = new btStaticPlaneShape(omni_cast<btVector3>(normal), this->planeOffset_);
+        this->collisionShape_ = this->planeShape_;
+    }
+
+    void PlaneCollisionShape::setOffset(float offset)
+    {
+        delete this->planeShape_;
+        this->planeOffset_ = offset;
+        this->planeShape_ = new btStaticPlaneShape(omni_cast<btVector3>(this->planeNormal_), offset);
+        this->collisionShape_ = this->planeShape_;
     }
 }
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/PlaneCollisionShape.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/PlaneCollisionShape.h	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/PlaneCollisionShape.h	(revision 2374)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      Reto Grieder
+ *      Martin Stypinski
  *   Co-authors:
  *      ...
@@ -33,5 +33,4 @@
 
 #include "BulletCollision/CollisionShapes/btStaticPlaneShape.h"
-
 #include "CollisionShape.h"
 
@@ -44,20 +43,25 @@
             virtual ~PlaneCollisionShape();
 
+            void registerVariables();
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-               
-            
             inline float getOffset()
                 { return this->planeShape_->getPlaneConstant();}
+            void setOffset(float offset);
 
             inline btVector3 getNormal()
                 { return this->planeShape_->getPlaneNormal();}
-            void setOffset(float offset);
             void setNormal(const Vector3& normal);
 
-           private:
-            virtual btVector3 getTotalScaling();
+            inline void planeNormalChanged()
+                { this->setNormal(this->planeNormal_); }
 
+            inline void planeOffsetChanged()
+                { this->setOffset(this->planeOffset_); }
+
+        private:
             btStaticPlaneShape* planeShape_;
+            Vector3             planeNormal_;
+            float               planeOffset_;
      };
 }
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.cc	(revision 2374)
@@ -46,4 +46,6 @@
         this->sphereShape_ = new btSphereShape(1.0f);
         this->collisionShape_ = this->sphereShape_;
+
+        this->registerVariables();
     }
 
@@ -52,4 +54,9 @@
         if (this->isInitialized())
             delete this->collisionShape_;
+    }
+
+    void SphereCollisionShape::registerVariables()
+    {
+        REGISTERDATA(this->radius_, network::direction::toclient, new network::NetworkCallback<SphereCollisionShape>(this, &SphereCollisionShape::radiusChanged));
     }
 
@@ -61,7 +68,10 @@
     }
 
-    btVector3 SphereCollisionShape::getTotalScaling()
+    void SphereCollisionShape::setRadius(float radius)
     {
-        return omni_cast<btVector3>(this->node_->getScale()) * this->radius_;
+        // TODO: Think about where this could be referenced already.
+        this->radius_ = radius;
+        delete this->sphereShape_;
+        this->sphereShape_ = new btSphereShape(radius);
     }
 }
Index: code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.h
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.h	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/collisionshapes/SphereCollisionShape.h	(revision 2374)
@@ -42,14 +42,15 @@
             virtual ~SphereCollisionShape();
 
+            void registerVariables();
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            inline void setRadius(float radius)
-                { this->radius_ = radius; }
+            void setRadius(float radius);
             inline float getRadius() const
                 { return this->radius_;}
 
+            inline void radiusChanged()
+                { this->setRadius(this->radius_); }
+
         private:
-            virtual btVector3 getTotalScaling();
-
             btSphereShape* sphereShape_;
             float          radius_;
Index: code/branches/physics/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 2374)
@@ -40,4 +40,5 @@
 namespace orxonox
 {
+    const float orientationGain = 100;
     CreateFactory(SpaceShip);
 
@@ -84,6 +85,5 @@
         if (this->physicalBody_)
         {
-            this->physicalBody_->setDamping(0.8, 0.9);
-            this->physicalBody_->setActivationState(DISABLE_DEACTIVATION);
+            this->physicalBody_->setDamping(0.7, 0.3);
         }
     }
@@ -106,68 +106,5 @@
     void SpaceShip::tick(float dt)
     {
-        if (this->isLocallyControlled())
-        {
-            // #####################################
-            // ############# STEERING ##############
-            // #####################################
-
-            //Vector3 velocity = this->getVelocity();
-            //if (velocity.x > this->maxSecondarySpeed_)
-            //    velocity.x = this->maxSecondarySpeed_;
-            //if (velocity.x < -this->maxSecondarySpeed_)
-            //    velocity.x = -this->maxSecondarySpeed_;
-            //if (velocity.y > this->maxSecondarySpeed_)
-            //    velocity.y = this->maxSecondarySpeed_;
-            //if (velocity.y < -this->maxSecondarySpeed_)
-            //    velocity.y = -this->maxSecondarySpeed_;
-            //if (velocity.z > this->maxSecondarySpeed_)
-            //    velocity.z = this->maxSecondarySpeed_;
-            //if (velocity.z < -this->maxSpeed_)
-            //    velocity.z = -this->maxSpeed_;
-
-            // normalize velocity and acceleration
-            //for (size_t dimension = 0; dimension < 3; ++dimension)
-            //{
-            //    if (this->acceleration_[dimension] == 0)
-            //    {
-            //        if (velocity[dimension] > 0)
-            //        {
-            //            velocity[dimension] -= (this->translationDamping_ * dt);
-            //            if (velocity[dimension] < 0)
-            //                velocity[dimension] = 0;
-            //        }
-            //        else if (velocity[dimension] < 0)
-            //        {
-            //            velocity[dimension] += (this->translationDamping_ * dt);
-            //            if (velocity[dimension] > 0)
-            //                velocity[dimension] = 0;
-            //        }
-            //    }
-            //}
-
-            //this->setVelocity(velocity);
-        }
-
-
         SUPER(SpaceShip, tick, dt);
-
-
-        //if (this->isLocallyControlled())
-        //{
-        //    this->yaw(this->yawRotation_ * dt);
-        //    if (this->bInvertYAxis_)
-        //        this->pitch(Degree(-this->pitchRotation_ * dt));
-        //    else
-        //        this->pitch(Degree( this->pitchRotation_ * dt));
-        //    this->roll(this->rollRotation_ * dt);
-
-        //    this->acceleration_.x = 0;
-        //    this->acceleration_.y = 0;
-        //    this->acceleration_.z = 0;
-
-        //    this->yawRotation_   = this->zeroDegree_;
-        //    this->pitchRotation_ = this->zeroDegree_;
-        //    this->rollRotation_  = this->zeroDegree_;
-        //}
     }
 
@@ -176,5 +113,4 @@
         assert(this->physicalBody_);
         this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * btVector3(0.0f, 0.0f, -getMass() * value.x * 100));
-//        this->acceleration_.z = -this->translationAcceleration_ * value.x;
     }
 
@@ -182,5 +118,4 @@
     {
         this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * btVector3(getMass() * value.x * 100, 0.0f, 0.0f));
-//        this->acceleration_.x = this->translationAcceleration_ * value.x;
     }
 
@@ -188,38 +123,19 @@
     {
         this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * btVector3(0.0f, getMass() * value.x * 100, 0.0f));
-//        this->acceleration_.y = this->translationAcceleration_ * value.x;
     }
 
     void SpaceShip::rotateYaw(const Vector2& value)
     {
-        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * btVector3(0.0f, getMass() * value.x * 10000, 0.0f));
-        //Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
-        //if (temp > this->maxRotation_)
-        //    temp = this->maxRotation_;
-        //if (temp < -this->maxRotation_)
-        //    temp = -this->maxRotation_;
-        //this->yawRotation_ = Degree(temp);
+        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * btVector3(0.0f, 1 / this->physicalBody_->getInvInertiaDiagLocal().y() * value.y * orientationGain, 0.0f));
     }
 
     void SpaceShip::rotatePitch(const Vector2& value)
     {
-        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * btVector3(getMass() * value.x * 10000, 0.0f, 0.0f));
-        //Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
-        //if (temp > this->maxRotation_)
-        //    temp = this->maxRotation_;
-        //if (temp < -this->maxRotation_)
-        //    temp = -this->maxRotation_;
-        //this->pitchRotation_ = Degree(temp);
+        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * btVector3(1 / this->physicalBody_->getInvInertiaDiagLocal().x() * value.y * orientationGain, 0.0f, 0.0f));
     }
 
     void SpaceShip::rotateRoll(const Vector2& value)
     {
-        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * btVector3(0.0f, 0.0f, -getMass() * value.x * 10000));
-        //Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_;
-        //if (temp > this->maxRotation_)
-        //    temp = this->maxRotation_;
-        //if (temp < -this->maxRotation_)
-        //    temp = -this->maxRotation_;
-        //this->rollRotation_ = Degree(temp);
+        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * btVector3(0.0f, 0.0f, -1 / this->physicalBody_->getInvInertiaDiagLocal().z() * value.y * orientationGain));
     }
 
Index: code/branches/physics/src/orxonox/objects/worldentities/pawns/Spectator.cc
===================================================================
--- code/branches/physics/src/orxonox/objects/worldentities/pawns/Spectator.cc	(revision 2373)
+++ code/branches/physics/src/orxonox/objects/worldentities/pawns/Spectator.cc	(revision 2374)
@@ -108,5 +108,5 @@
             Vector3 velocity = this->getVelocity();
             velocity.normalise();
-            this->setVelocity(velocity * this->speed_);
+            this->setVelocity(this->getOrientation() * velocity * this->speed_);
 
             this->yaw(Radian(this->yaw_ * this->rotationSpeed_));
