[Orxonox-commit 3742] r8422 - in code/branches/pickup/src: modules/objects/collisionshapes orxonox/collisionshapes orxonox/worldentities

dafrick at orxonox.net dafrick at orxonox.net
Sun May 8 23:45:32 CEST 2011


Author: dafrick
Date: 2011-05-08 23:45:32 +0200 (Sun, 08 May 2011)
New Revision: 8422

Modified:
   code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.cc
   code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.h
   code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.cc
   code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.h
   code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.cc
   code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.h
   code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.cc
   code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.h
   code/branches/pickup/src/orxonox/collisionshapes/CollisionShape.cc
   code/branches/pickup/src/orxonox/collisionshapes/CollisionShape.h
   code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc
   code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h
   code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc
Log:
Documenting collision shapes in an effort to understand them and implement scaling.
Scaling is however not working yet, and thus not yet enabled.


Modified: code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.cc
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.cc	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.cc	2011-05-08 21:45:32 UTC (rev 8422)
@@ -26,6 +26,11 @@
  *
  */
 
+/**
+    @file BoxCollisionShape.cc
+    @brief Implementation of the BoxCollisionShape class.
+*/
+
 #include "BoxCollisionShape.h"
 
 #include <BulletCollision/CollisionShapes/btBoxShape.h>
@@ -38,18 +43,23 @@
 {
     CreateFactory(BoxCollisionShape);
 
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
     BoxCollisionShape::BoxCollisionShape(BaseObject* creator) : CollisionShape(creator)
     {
         RegisterObject(BoxCollisionShape);
 
         this->halfExtents_ = Vector3(1, 1, 1);
-        updateShape();
+        this->updateShape();
 
         this->registerVariables();
     }
 
     BoxCollisionShape::~BoxCollisionShape()
     {
+        // TODO: Move to CollisionShape?
         if (this->isInitialized())
             delete this->collisionShape_;
     }
@@ -69,6 +79,32 @@
         XMLPortParamLoadOnly(BoxCollisionShape, "length", setLength, xmlelement, mode);
     }
 
+    /**
+    @brief
+        Is called when the scale of the BoxCollisionShape has changed.
+    */
+    void BoxCollisionShape::changedScale()
+    {
+        CollisionShape::changedScale();
+
+        // Resize the internal collision shape
+        // TODO: Assuming setLocalScaling works.
+        // this->collisionShape_->setLocalScaling(multi_cast<btVector3>(this->getScale3D()));
+        if(!this->hasUniformScaling())
+        {
+            CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+            return;
+        }
+
+        this->setHalfExtents(this->halfExtents_ * this->getScale());
+    }
+
+    /**
+    @brief
+        Creates a new internal collision shape for the BoxCollisionShape.
+    @return
+        Returns a pointer to the newly created btBoxShape.
+    */
     btCollisionShape* BoxCollisionShape::createNewShape() const
     {
         return new btBoxShape(multi_cast<btVector3>(this->halfExtents_));

Modified: code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.h
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.h	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.h	2011-05-08 21:45:32 UTC (rev 8422)
@@ -42,6 +42,16 @@
 
 namespace orxonox
 {
+
+    /**
+    @brief
+        Wrapper for the bullet box collision shape class btBoxShape.
+
+    @author
+        Reto Grieder
+
+    @ingroup Collisionshapes
+    */
     class _ObjectsExport BoxCollisionShape : public CollisionShape
     {
         public:
@@ -50,32 +60,75 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            inline void setHalfExtents(const Vector3& extents)
-                { this->halfExtents_ = extents; updateShape(); }
+            /**
+            @brief Set the half extents of the BoxCollisionShape.
+                   If the half extent changes, this causes the internal collision shape to be recreated.
+            @param extents A vector with the half extents.
+                   The x-component is half the length, the y-component is half the height and the z-component is half the width.
+            @return Returns true if the half extent has changed, false if not.
+            */
+            inline bool setHalfExtents(const Vector3& extents)
+                { if(this->halfExtents_ == extents) return false; this->halfExtents_ = extents; updateShape(); return true; }
+            /**
+            @brief Get the half extents of the BoxCollisionShape.
+            @return Returns a vector containing the half extents.
+            */
             inline const Vector3& getHalfExtents() const
                 { return halfExtents_;}
 
-            inline void setWidth(float value)
-                { this->halfExtents_.z = value / 2; updateShape(); }
+            /**
+            @brief Set the width of the BoxCollisionShape.
+                   If the width changes, this causes the internal collision shape to be recreated.
+            @param value The width to be set.
+            @return Returns true if the width has changed, false if not.
+            */
+            inline bool setWidth(float value)
+                { if(this->halfExtents_.z == value/2.0f) return false; this->halfExtents_.z = value / 2.0f; updateShape(); return true; }
+            /**
+            @brief Get the width of the BoxCollisionShape.
+            @return Returns the width of the BoxCollisionShape.
+            */
             inline float getWidth() const
-                { return this->halfExtents_.z * 2; }
+                { return this->halfExtents_.z * 2.0f; }
 
-            inline void setHeight(float value)
-                { this->halfExtents_.y = value / 2; updateShape(); }
+            /**
+            @brief Set the height of the BoxCollisionShape.
+                   If the height changes, this causes the internal collision shape to be recreated.
+            @param value The height to be set.
+            @return Returns true if the height has changed, false if not.
+            */
+            inline bool setHeight(float value)
+                { if(this->halfExtents_.y == value/2.0f) return false; this->halfExtents_.y = value / 2.0f; updateShape(); return true; }
+            /**
+            @brief Get the height of the BoxCollisionShape.
+            @return Returns the height of the BoxCollisionShape.
+            */
             inline float getHeight() const
-                { return this->halfExtents_.y * 2; }
+                { return this->halfExtents_.y * 2.0f; }
 
-            inline void setLength(float value)
-                { this->halfExtents_.x = value / 2; updateShape(); }
+            /**
+            @brief Set the length of the BoxCollisionShape.
+                   If the length changes, this causes the internal collision shape to be recreated.
+            @param value The length to be set.
+            @return Returns true if the length has changed, false if not.
+            */
+            inline bool setLength(float value)
+                { if(this->halfExtents_.x == value/2.0f) return false; this->halfExtents_.x = value / 2.0f; updateShape(); return true; }
+            /**
+            @brief Get the length of the BoxCollisionShape.
+            @return Returns the length of the BoxCollisionShape.
+            */
             inline float getLength() const
-                { return this->halfExtents_.x * 2; }
+                { return this->halfExtents_.x * 2.0f; }
 
+            virtual void changedScale(); // Is called when the scale of the BoxCollisionShape has changed.
+
         private:
             void registerVariables();
 
-            btCollisionShape* createNewShape() const;
+            btCollisionShape* createNewShape() const; // Creates a new internal collision shape for the BoxCollisionShape.
 
-            Vector3 halfExtents_;
+            Vector3 halfExtents_; //!< The half extents of the BoxCollisionShape. The x-component is half the length, the y-component is half the height and the z-component is half the width.
      };
 }
 

Modified: code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.cc
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.cc	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.cc	2011-05-08 21:45:32 UTC (rev 8422)
@@ -26,17 +26,27 @@
  *
  */
 
+/**
+    @file ConeCollisionShape.cc
+    @brief Implementation of the ConeCollisionShape class.
+*/
+
 #include "ConeCollisionShape.h"
 
 #include <BulletCollision/CollisionShapes/btConeShape.h>
 
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
 
 namespace orxonox
 {
     CreateFactory(ConeCollisionShape);
 
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
     ConeCollisionShape::ConeCollisionShape(BaseObject* creator) : CollisionShape(creator)
     {
         RegisterObject(ConeCollisionShape);
@@ -68,6 +78,34 @@
         XMLPortParam(ConeCollisionShape, "height", setHeight, getHeight, xmlelement, mode);
     }
 
+    /**
+    @brief
+        Is called when the scale of the ConeCollisionShape has changed.
+    */
+    void ConeCollisionShape::changedScale()
+    {
+        CollisionShape::changedScale();
+
+        // Resize the internal collision shape
+        // TODO: Assuming setLocalScaling works.
+        //this->collisionShape_->setLocalScaling(multi_cast<btVector3>(this->getScale3D()));
+        if(!this->hasUniformScaling())
+        {
+            CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+            return;
+        }
+
+        this->radius_ *= this->getScale();
+        this->height_ *= this->getScale();
+        this->updateShape();
+    }
+
+    /**
+    @brief
+        Creates a new internal collision shape for the ConeCollisionShape.
+    @return
+        Returns a pointer to the newly created btConeShape.
+    */
     btCollisionShape* ConeCollisionShape::createNewShape() const
     {
         return new btConeShape(this->radius_, this->height_);

Modified: code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.h
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.h	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.h	2011-05-08 21:45:32 UTC (rev 8422)
@@ -40,6 +40,16 @@
 
 namespace orxonox
 {
+
+    /**
+    @brief
+        Wrapper for the bullet cone collision shape class btConeShape.
+
+    @author
+        Reto Grieder
+
+    @ingroup Collisionshapes.
+    */
     class _ObjectsExport ConeCollisionShape : public CollisionShape
     {
         public:
@@ -48,23 +58,45 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            inline void setRadius(float value)
-                { this->radius_ = value; updateShape(); }
+            /**
+            @brief Set the radius of the ConeCollisionShape.
+                   If the radius changes, this causes the internal collision shape to be recreated.
+            @param value The radius to be set.
+            @return Returns true if the radius has changed, false if not.
+            */
+            inline bool setRadius(float value)
+                { if(this->radius_ == value) return false; this->radius_ = value; updateShape(); return true; }
+            /**
+            @brief Get the radius of the ConeCollisionShape.
+            @return Returns the radius of the ConeCollisionShape.
+            */
             inline float getRadius() const
                 { return radius_; }
 
-            inline void setHeight(float value)
-                { this->height_ = value; updateShape(); }
+            /**
+            @brief Set the height of the ConeCollisionShape.
+                   If the height changes, this causes the internal collision shape to be recreated.
+            @param value The height to be set.
+            @return Returns true if the height has changed, false if not.
+            */
+            inline bool setHeight(float value)
+                { if(this->height_ == value) return false; this->height_ = value; updateShape(); return true; }
+            /**
+            @brief Get the height of the ConeCollisionShape.
+            @return Returns the height of the ConeCollisionShape.
+            */
             inline float getHeight() const
                 { return this->height_; }
 
+            virtual void changedScale(); // Is called when the scale of the ConeCollisionShape has changed.
+
         private:
             void registerVariables();
 
-            btCollisionShape* createNewShape() const;
+            btCollisionShape* createNewShape() const; // Creates a new internal collision shape for the ConeCollisionShape.
 
-            float radius_;
-            float height_;
+            float radius_; //!< The radius of the ConeCollisionShape.
+            float height_; //!< The height of the ConeCollisionShape.
      };
 }
 

Modified: code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.cc
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.cc	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.cc	2011-05-08 21:45:32 UTC (rev 8422)
@@ -26,6 +26,11 @@
  *
  */
 
+/**
+    @file PlaneCollisionShape.cc
+    @brief Implementation of the PlaneCollisionShape class.
+*/
+
 #include "PlaneCollisionShape.h"
 
 #include <BulletCollision/CollisionShapes/btStaticPlaneShape.h>
@@ -38,6 +43,10 @@
 {
     CreateFactory(PlaneCollisionShape);
 
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
     PlaneCollisionShape::PlaneCollisionShape(BaseObject* creator) : CollisionShape(creator)
     {
         RegisterObject(PlaneCollisionShape);
@@ -69,6 +78,32 @@
         XMLPortParam(PlaneCollisionShape, "offset", setOffset, getOffset, xmlelement, mode);
     }
 
+    /**
+    @brief
+        Is called when the scale of the PlaneCollisionShape has changed.
+    */
+    void PlaneCollisionShape::changedScale()
+    {
+        CollisionShape::changedScale();
+
+        // Resize the internal collision shape
+        // TODO: Assuming setLocalScaling works.
+        //this->collisionShape_->setLocalScaling(multi_cast<btVector3>(this->getScale3D()));
+        if(!this->hasUniformScaling())
+        {
+            CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+            return;
+        }
+
+        this->setOffset(this->offset_*this->getScale());
+    }
+
+    /**
+    @brief
+        Creates a new internal collision shape for the PlaneCollisionShape.
+    @return
+        Returns a pointer to the newly created btStaticPlaneShape.
+    */
     btCollisionShape* PlaneCollisionShape::createNewShape() const
     {
         return new btStaticPlaneShape(multi_cast<btVector3>(this->normal_), this->offset_);

Modified: code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.h
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.h	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.h	2011-05-08 21:45:32 UTC (rev 8422)
@@ -42,6 +42,16 @@
 
 namespace orxonox
 {
+
+    /**
+    @brief
+        Wrapper for the bullet plane collision shape class btStaticPlaneShape.
+
+    @author
+        Martin Stypinski
+
+    @ingroup Collisionshapes
+    */
     class _ObjectsExport PlaneCollisionShape : public CollisionShape
     {
         public:
@@ -50,23 +60,45 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            inline void setNormal(const Vector3& normal)
-                { this->normal_ = normal; updateShape(); }
-            inline const Vector3& getNormal()
+            /**
+            @brief Set the normal of the PlaneCollisionShape.
+                   If the normal changes, this causes the internal collision shape to be recreated.
+            @param normal The normal vector to be set.
+            @return Returns true if the normal has changed, false if not.
+            */
+            inline bool setNormal(const Vector3& normal)
+                { if(this->normal_ == normal) return false; this->normal_ = normal; updateShape(); return true; }
+            /**
+            @brief Get the normal of the PlaneCollisionShape.
+            @return Returns the normal vector of the PlaneCollisionShape.
+            */
+            inline const Vector3& getNormal() const
                 { return normal_;}
 
-            inline void setOffset(float offset)
-                { this->offset_ = offset; updateShape(); }
-            inline float getOffset()
+            /**
+            @brief Set the offset of the PlaneCollisionShape.
+                   If the offset changes, this causes the internal collision shape to be recreated.
+            @param offset The offset to be set.
+            @return Returns true if the offset has changed, false if not.
+            */
+            inline bool setOffset(float offset)
+                { if(this->offset_ == offset) return false; this->offset_ = offset; updateShape(); return true; }
+            /**
+            @brief Get the offset of the PlaneCollisionShape.
+            @return Returns the offset of the PlaneCollisionShape.
+            */
+            inline float getOffset() const
                 { return this->offset_;}
 
+            virtual void changedScale(); // Is called when the scale of the PlaneCollisionShape has changed.
+
         private:
             void registerVariables();
 
-            btCollisionShape* createNewShape()const;
+            btCollisionShape* createNewShape() const; // Creates a new internal collision shape for the PlaneCollisionShape.
 
-            Vector3 normal_;
-            float   offset_;
+            Vector3 normal_; //!< The normal vector of the PlaneCollisionShape.
+            float   offset_; //!< The offset of the PlaneCollisionShape.
      };
 }
 

Modified: code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.cc
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.cc	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.cc	2011-05-08 21:45:32 UTC (rev 8422)
@@ -26,17 +26,27 @@
  *
  */
 
+/**
+    @file SphereCollisionShape.cc
+    @brief Implementation of the SphereCollisionShape class.
+*/
+
 #include "SphereCollisionShape.h"
 
 #include <BulletCollision/CollisionShapes/btSphereShape.h>
 
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
 
 namespace orxonox
 {
     CreateFactory(SphereCollisionShape);
 
+    /**
+    @brief
+        Constructor. registers and initializes the object.
+    */
     SphereCollisionShape::SphereCollisionShape(BaseObject* creator) : CollisionShape(creator)
     {
         RegisterObject(SphereCollisionShape);
@@ -65,6 +75,32 @@
         XMLPortParam(SphereCollisionShape, "radius", setRadius, getRadius, xmlelement, mode);
     }
 
+    /**
+    @brief
+        Is called when the scale of the SphereCollisionShape has changed.
+    */
+    void SphereCollisionShape::changedScale()
+    {
+        CollisionShape::changedScale();
+
+        // Resize the internal collision shape
+        // TODO: Assuming setLocalScaling works.
+        //this->collisionShape_->setLocalScaling(multi_cast<btVector3>(this->getScale3D()));
+        if(!this->hasUniformScaling())
+        {
+            CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+            return;
+        }
+
+        this->setRadius(this->radius_*this->getScale());
+    }
+
+    /**
+    @brief
+        Creates a new internal collision shape for the SphereCollisionShape.
+    @return
+        Returns a pointer to the newly created btSphereShape.
+    */
     btCollisionShape* SphereCollisionShape::createNewShape() const
     {
         return new btSphereShape(this->radius_);

Modified: code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.h
===================================================================
--- code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.h	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.h	2011-05-08 21:45:32 UTC (rev 8422)
@@ -40,6 +40,16 @@
 
 namespace orxonox
 {
+
+    /**
+    @brief
+        Wrapper for the bullet sphere collision shape class btSphereShape.
+
+    @author
+        Reto Grieder
+
+    @ingroup Collisionshapes
+    */
     class _ObjectsExport SphereCollisionShape : public CollisionShape
     {
         public:
@@ -48,17 +58,29 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            inline void setRadius(float radius)
-                { this->radius_ = radius; updateShape(); }
+            /**
+            @brief Set the radius of the SphereCollisionShape.
+                   If the radius changes, this causes the internal collision shape to be recreated.
+            @param radius The radius to be set.
+            @return Returns true if the radius has changed, false if not.
+            */
+            inline bool setRadius(float radius)
+                { if(this->radius_ == radius) return false; this->radius_ = radius; updateShape(); return true; }
+            /**
+            @brief Get the radius of the SphereCollisionShape.
+            @return Returns the radius of the SphereCollisionShape.
+            */
             inline float getRadius() const
                 { return this->radius_; }
 
+            virtual void changedScale(); // Is called when the scale of the SphereCollisionShape has changed.
+
         private:
             void registerVariables();
 
             btCollisionShape* createNewShape() const;
 
-            float radius_;
+            float radius_; //!< The radius of the SphereCollisionShape.
     };
 }
 

Modified: code/branches/pickup/src/orxonox/collisionshapes/CollisionShape.cc
===================================================================
--- code/branches/pickup/src/orxonox/collisionshapes/CollisionShape.cc	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/orxonox/collisionshapes/CollisionShape.cc	2011-05-08 21:45:32 UTC (rev 8422)
@@ -26,6 +26,11 @@
  *
  */
 
+/**
+    @file CollisionShape.cc
+    @brief Implementation of the CollisionShape class.
+*/
+
 #include "CollisionShape.h"
 
 #include <BulletCollision/CollisionShapes/btCollisionShape.h>
@@ -38,6 +43,11 @@
 
 namespace orxonox
 {
+
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
     CollisionShape::CollisionShape(BaseObject* creator)
         : BaseObject(creator)
         , Synchronisable(creator)
@@ -50,13 +60,18 @@
         this->position_ = Vector3::ZERO;
         this->orientation_ = Quaternion::IDENTITY;
         this->scale_ = Vector3::UNIT_SCALE;
+        this->uniformScale_ = true;
 
         this->registerVariables();
     }
 
+    /**
+    @brief
+        Destructor. Detaches the CollisionShape from its parent.
+    */
     CollisionShape::~CollisionShape()
     {
-        // Detach from parent
+        // Detach from parent CompoundCollisionShape.
         if (this->isInitialized() && this->parent_)
             this->parent_->detach(this);
     }
@@ -74,81 +89,181 @@
         XMLPortParamLoadOnly(CollisionShape, "roll",  roll,  xmlelement, mode);
     }
 
+    /**
+    @brief
+        Register variables that need synchronizing over the network.
+    */
     void CollisionShape::registerVariables()
     {
+        // Keep the shape's parent (can be either a CompoundCollisionShape or a WorldEntity) consistent over the network.
         registerVariable(this->parentID_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::parentChanged));
     }
 
-    void CollisionShape::parentChanged()
-    {
-        Synchronisable* parent = Synchronisable::getSynchronisable(this->parentID_);
-        // Parent can either be a WorldEntity or a CompoundCollisionShape. The reason is that the
-        // internal collision shape (which is compound) of a WE doesn't get synchronised.
-        CompoundCollisionShape* parentCCS = orxonox_cast<CompoundCollisionShape*>(parent);
-        if (parentCCS)
-            parentCCS->attach(this);
-        else
-        {
-            WorldEntity* parentWE = orxonox_cast<WorldEntity*>(parent);
-            if (parentWE)
-                parentWE->attachCollisionShape(this);
-        }
-    }
-
+    /**
+    @brief
+        Notifies the CollisionShape of being attached to a CompoundCollisionShape.
+    @param newParent
+        A pointer to the CompoundCollisionShape the CollisionShape was attached to.
+    @return
+        Returns 
+    */
     bool CollisionShape::notifyBeingAttached(CompoundCollisionShape* newParent)
     {
+        // If the CollisionShape is attached to a CompoundCollisionShapes, detach it.
         if (this->parent_)
             this->parent_->detach(this);
 
         this->parent_ = newParent;
 
+        // If the new parent is a WorldEntityCollisionShape, the parentID is set to the objectID of the WorldEntity that is its owner.
+        // TODO: Why?
         WorldEntityCollisionShape* parentWECCS = orxonox_cast<WorldEntityCollisionShape*>(newParent);
         if (parentWECCS)
             this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID();
+        // Else it is set to the objectID of the CompoundCollisionShape.
         else
             this->parentID_ = newParent->getObjectID();
 
         return true;
     }
 
+    /**
+    @brief
+        Notifies the CollisionShape of being detached from a CompoundCollisionShape.
+    */
     void CollisionShape::notifyDetached()
     {
         this->parent_ = 0;
         this->parentID_ = OBJECTID_UNKNOWN;
     }
 
+    /**
+    @brief
+        Updates the CompoundCollisionShape the CollisionShape belongs to (if it belongs to one), after the CollisionShape has changed.
+    */
     void CollisionShape::updateParent()
     {
         if (this->parent_)
             this->parent_->updateAttachedShape(this);
     }
 
+    /**
+    @brief
+        Is called when the parentID of the CollisionShape has changed.
+        Attaches it to the object with the changed parentID, which can either be a CompoundCollisionShape or a WorldEntity.
+    */
+    void CollisionShape::parentChanged()
+    {
+        // Get the parent object from the network.
+        Synchronisable* parent = Synchronisable::getSynchronisable(this->parentID_);
+
+        // Parent can either be a WorldEntity or a CompoundCollisionShape. The reason is that the
+        // internal collision shape (which is compound) of a WE doesn't get synchronised.
+        CompoundCollisionShape* parentCCS = orxonox_cast<CompoundCollisionShape*>(parent);
+
+        // If the parent is a CompoundCollisionShape, attach the CollisionShape to it.
+        if (parentCCS)
+            parentCCS->attach(this);
+        else
+        {
+            // If the parent is a WorldEntity, attach the CollisionShape to its collision shapes.
+            WorldEntity* parentWE = orxonox_cast<WorldEntity*>(parent);
+            if (parentWE)
+                parentWE->attachCollisionShape(this);
+        }
+    }
+
+    /**
+    @brief
+        Check whether the CollisionShape has been either moved or rotated or both. (i.e. it doesn't have position zero and identity orientation any more)
+    @return
+        Returns true if it has been moved.
+    */
     bool CollisionShape::hasTransform() const
     {
         return (!this->position_.positionEquals(Vector3(0, 0, 0), 0.001f) ||
                 !this->orientation_.equals(Quaternion(1,0,0,0), Degree(0.1f)));
     }
 
+    /**
+    @brief
+        Set the scale of the CollisionShape.
+        Since the scale is a vector the CollisionShape can be scaled independently in each direction, allowing for linear distortions.
+        If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+        Beware, non-uniform scaling (i.e. distortions) might not be supported by all CollisionShapes.
+    @param scale
+        The new scale to be set. Vector3::UNIT_SCALE is the initial scale.
+    */
     void CollisionShape::setScale3D(const Vector3& scale)
     {
-        CCOUT(2) << "Warning: Cannot set the scale of a collision shape: Not yet implemented." << std::endl;
+        if(this->scale_ == scale)
+            return;
+
+        // If the vectors are not in the same direction, then this is no longer a uniform scaling.
+        if(scale_.crossProduct(scale).squaredLength() != 0.0f)
+        {
+            CCOUT(2) << "Warning: Non-uniform scaling is not yet supported." << endl;
+            return;
+        }
+
+        this->scale_ = scale;
+
+        this->changedScale();
+        this->updateParent();
     }
 
+    /**
+    @brief
+        Set the (uniform) scale of the CollisionShape.
+        If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+    @param scale
+        The scale to scale the CollisionShape with. 1.0f is the initial scale.
+    */
     void CollisionShape::setScale(float scale)
     {
-        CCOUT(2) << "Warning: Cannot set the scale of a collision shape: Not yet implemented." << std::endl;
+        if(this->scale_.length() == scale)
+            return;
+
+        this->scale_ = Vector3::UNIT_SCALE*scale;
+
+        this->changedScale();
+        this->updateParent();
     }
 
+    /**
+    @brief
+        Is called when the scale of the CollisionShape has changed.
+    */
+    void CollisionShape::changedScale()
+    {
+        // Adjust the position of the CollisionShape.
+        this->position_ *= this->getScale3D();
+    }
+
+    /**
+    @brief
+        Updates the shape.
+        Is called when the internal parameters of the shape have changed such that a new shape needs to be created.
+    */
     void CollisionShape::updateShape()
     {
         btCollisionShape* oldShape = this->collisionShape_;
         this->collisionShape_ = this->createNewShape();
+        // If the CollisionShape has been rescaled, scale the shape to fit the current scale.
+        if(this->scale_ != Vector3::UNIT_SCALE)
+            this->changedScale();
         // When we recreate the shape, we have to inform the parent about this to update the shape
         this->updateParent();
         if (oldShape)
             delete oldShape;
     }
 
+    /**
+    @brief
+        Calculates the local inertia of the collision shape.
+    @todo
+        Document.
+    */
     void CollisionShape::calculateLocalInertia(float mass, btVector3& inertia) const
     {
         if (this->collisionShape_)

Modified: code/branches/pickup/src/orxonox/collisionshapes/CollisionShape.h
===================================================================
--- code/branches/pickup/src/orxonox/collisionshapes/CollisionShape.h	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/orxonox/collisionshapes/CollisionShape.h	2011-05-08 21:45:32 UTC (rev 8422)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file CollisionShape.h
+    @brief Definition of the CollisionShape class.
+    @ingroup Collisionshapes
+*/
+
 #ifndef _CollisionShape_H__
 #define _CollisionShape_H__
 
@@ -37,6 +43,17 @@
 
 namespace orxonox
 {
+
+    /**
+    @brief
+        Wrapper for bullet collision shape class btCollisionShape.
+
+    @author
+        Reto Grieder
+
+    @see btCollisionShape
+    @ingroup Collisionshapes
+    */
     class _OrxonoxExport CollisionShape : public BaseObject, public Synchronisable
     {
         public:
@@ -45,52 +62,134 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
+            /**
+            @brief Set the position of the CollisionShape.
+                   If the position changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+            @param position A vector indicating the new position.
+            */
             inline void setPosition(const Vector3& position)
-                { this->position_ = position; this->updateParent(); }
+                { if(this->position_ == position) return; this->position_ = position; this->updateParent(); }
+            /**
+            @brief Get the position of the CollisionShape.
+            @return Returns the position of the CollisionShape as a vector.
+            */
             inline const Vector3& getPosition() const
                 { return this->position_; }
 
+            /**
+            @brief Set the orientation of the CollisionShape.
+                   If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+            @param orientation A quaternion indicating the new orientation.
+            */
             inline void setOrientation(const Quaternion& orientation)
-                { this->orientation_ = orientation; this->updateParent(); }
+                { if(this->orientation_ == orientation) return; this->orientation_ = orientation; this->updateParent(); }
+            /**
+            @brief Get the orientation of the CollisionShape.
+            @return Returns the orientation of the CollisionShape as a quaternion.
+            */
             inline const Quaternion& getOrientation() const
                 { return this->orientation_; }
 
-            void yaw(const Degree& angle)   { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Y)); }
-            void pitch(const Degree& angle) { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_X)); }
-            void roll(const Degree& angle)  { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Z)); }
+            /**
+            @brief Rotate the CollisionShape around the y-axis by the specified angle.
+                   If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+            @param angle The angle by which the CollisionShape is rotated.
+            */
+            void yaw(const Degree& angle)
+                { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Y)); }
+            /**
+            @brief Rotate the CollisionShape around the x-axis by the specified angle.
+                   If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+            @param angle The angle by which the CollisionShape is rotated.
+            */
+            void pitch(const Degree& angle)
+                { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_X)); }
+            /**
+            @brief Rotate the CollisionShape around the z-axis by the specified angle.
+                   If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+            @param angle The angle by which the CollisionShape is rotated.
+            */
+            void roll(const Degree& angle)
+                { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Z)); }
 
-            virtual void setScale3D(const Vector3& scale);
-            virtual void setScale(float scale);
+            /**
+            @brief Scale the CollisionShape by the input vector.
+                   Since the scale is a vector the CollisionShape can be scaled independently in each direction, allowing for linear distortions.
+                   If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+                   Beware, non-uniform scaling (i.e. distortions) might not be supported by all CollisionShapes.
+            @param scale The scaling vector by which the CollisionShape is scaled.
+            */
+            inline void scale3D(const Vector3& scale)
+                { this->setScale3D(this->getScale3D()*scale); }
+            void setScale3D(const Vector3& scale); // Set the scale of the CollisionShape.
+            /**
+            @brief Get the scale of the CollisionShape.
+            @return Returns a vector indicating the scale of the CollisionShape.
+            */
             inline const Vector3& getScale3D() const
                 { return this->scale_; }
 
-            void updateShape();
+            /**
+            @brief (Uniformly) scale the CollisionShape by the input scale.
+                   If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+            @param scale The value by which the CollisionShape is scaled.
+            */
+            inline void scale(float scale)
+                { this->setScale3D(this->getScale3D()*scale); }
+            void setScale(float scale); // Set the (uniform) scale of the CollisionShape.
+            /**
+            @brief Get the (uniform) scale of the CollisionShape.
+                   This is only meaningful if the CollisionShape has uniform scaling.
+            @return Returns the (uniform) scale of the CollisionShape. Returns 0.0f if the scaling is non-uniform.
+            */
+            inline float getScale()
+                { if(this->hasUniformScaling()) return this->scale_.x; return 0.0f; }
 
-            void calculateLocalInertia(float mass, btVector3& inertia) const;
+            /**
+            @brief Check whether the CollisionShape is uniformly scaled.
+            @return Returns true if the CollisionShape is uniformly scaled, false if not.
+            */
+            inline bool hasUniformScaling()
+                { return this->uniformScale_; }
+            virtual void changedScale(); // Is called when the scale of the CollisionShape has changed.
 
+            void updateShape(); // Updates the shape.
+
+            void calculateLocalInertia(float mass, btVector3& inertia) const; // Calculates the local inertia of the collision shape.
+
+            /**
+            @brief Get the bullet collision shape of this CollisionShape.
+            @return Returns a pointer to the bullet collision shape of this CollisionShape.
+            */
             inline btCollisionShape* getCollisionShape() const
                 { return this->collisionShape_; }
 
-            bool hasTransform() const;
+            bool hasTransform() const; // Check whether the CollisionShape has been either moved or rotated or both.
 
-            bool notifyBeingAttached(CompoundCollisionShape* newParent);
-            void notifyDetached();
+            bool notifyBeingAttached(CompoundCollisionShape* newParent); // Notifies the CollisionShape of being attached to a CompoundCollisionShape.
+            void notifyDetached(); // Notifies the CollisionShape of being detached from a CompoundCollisionShape.
 
         protected:
-            virtual void updateParent();
-            virtual void parentChanged();
+            virtual void updateParent(); // Updates the CompoundCollisionShape the CollisionShape belongs to, after the CollisionShape has changed.
+            virtual void parentChanged(); // Is called when the parentID of the CollisionShape has changed.
+
+            /**
+            @brief Create a new bullet collision shape depending on the internal parameters of the specific CollisionShape.
+            @return Returns a pointer to the new bullet collision shape.
+            */
             virtual btCollisionShape* createNewShape() const = 0;
 
-            btCollisionShape*       collisionShape_;
-            CompoundCollisionShape* parent_;
-            unsigned int            parentID_;
+            btCollisionShape*       collisionShape_; //!< The bullet collision shape of this CollisionShape.
+            CompoundCollisionShape* parent_; //!< The CompoundCollisionShape this CollisionShape belongs to, NULL if it doesn't belong to one.
+            unsigned int            parentID_; //!< The objectID of the parent of this CollisionShape, which can either be a CompoundCollisionShape or a WorldEntity.
 
         private:
             void registerVariables();
 
-            Vector3                 position_;
-            Quaternion              orientation_;
-            Vector3                 scale_;
+            Vector3                 position_; //!< The position of the CollisionShape.
+            Quaternion              orientation_; //!< The orientation of the CollisionShape.
+            Vector3                 scale_; //!< The scale of the CollisionShape.
+            bool                    uniformScale_; //!< Whether the scale is uniform.
     };
 }
 

Modified: code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc
===================================================================
--- code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc	2011-05-08 21:45:32 UTC (rev 8422)
@@ -26,6 +26,11 @@
  *
  */
 
+/**
+    @file CompoundCollisionShape.cc
+    @brief Implementation of the CompoundCollisionShape class.
+*/
+
 #include "CompoundCollisionShape.h"
 
 #include <BulletCollision/CollisionShapes/btCompoundShape.h>
@@ -38,6 +43,10 @@
 {
     CreateFactory(CompoundCollisionShape);
 
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    */
     CompoundCollisionShape::CompoundCollisionShape(BaseObject* creator) : CollisionShape(creator)
     {
         RegisterObject(CompoundCollisionShape);
@@ -45,6 +54,11 @@
         this->compoundShape_  = new btCompoundShape();
     }
 
+    /**
+    @brief
+        Destructor.
+        Deletes all its children.
+    */
     CompoundCollisionShape::~CompoundCollisionShape()
     {
         if (this->isInitialized())
@@ -69,38 +83,56 @@
         XMLPortObject(CompoundCollisionShape, CollisionShape, "", attach, detach, xmlelement, mode);
     }
 
+    /**
+    @brief
+        Attach the input CollisionShape to the CompoundCollisionShape.
+    @param shape
+        A pointer to the CollisionShape that is to be attached.
+    */
     void CompoundCollisionShape::attach(CollisionShape* shape)
     {
+        // If either the input shape is NULL or we try to attach the CollisionShape to itself.
         if (!shape || static_cast<CollisionShape*>(this) == shape)
             return;
+
         if (this->attachedShapes_.find(shape) != this->attachedShapes_.end())
         {
             CCOUT(2) << "Warning: Attaching a CollisionShape twice is not yet supported." << std::endl;
             return;
         }
 
+        // Notify the CollisionShape that it is being attached to the CompoundCollisionShape.
         if (!shape->notifyBeingAttached(this))
             return;
 
+        // Attach it.
         this->attachedShapes_[shape] = shape->getCollisionShape();
 
+        // Only actually attach if we didn't pick a CompoundCollisionShape with no content.
         if (shape->getCollisionShape())
         {
-            // Only actually attach if we didn't pick a CompoundCollisionShape with no content
             btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition()));
+            // Add the btCollisionShape of the CollisionShape as a child shape to the btCompoundShape of the CompoundCollisionShape.
             this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
 
             this->updatePublicShape();
         }
     }
 
+    /**
+    @brief
+        Detach the input CollisionShape form the CompoundCollisionShape.
+    @param shape
+        A pointer to the CollisionShape to be detached.
+    */
     void CompoundCollisionShape::detach(CollisionShape* shape)
     {
+        // If the input CollisionShape is actually attached.
         if (this->attachedShapes_.find(shape) != this->attachedShapes_.end())
         {
             this->attachedShapes_.erase(shape);
             if (shape->getCollisionShape())
-                this->compoundShape_->removeChildShape(shape->getCollisionShape());
+                this->compoundShape_->removeChildShape(shape->getCollisionShape()); // TODO: Apparently this is broken?
             shape->notifyDetached();
 
             this->updatePublicShape();
@@ -109,17 +141,30 @@
             CCOUT(2) << "Warning: Cannot detach non child collision shape" << std::endl;
     }
 
+    /**
+    @brief
+        Detach all attached CollisionShapes.
+    */
     void CompoundCollisionShape::detachAll()
     {
         while (this->attachedShapes_.size() > 0)
             this->detach(this->attachedShapes_.begin()->first);
     }
 
+    /**
+    @brief
+        Update the input CollisionShape that is attached to the CompoundCollisionShape.
+        This is called when the input shape's internal collision shape (a btCollisionShape) has changed.
+    @param shape
+        A pointer to the CollisionShape to be updated.
+    */
     void CompoundCollisionShape::updateAttachedShape(CollisionShape* shape)
     {
         if (!shape)
             return;
+
         std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.find(shape);
+        // Check whether the input shape belongs to this CompoundCollisionShape.
         if (it == this->attachedShapes_.end())
         {
             CCOUT(2) << "Warning: Cannot update child shape: Instance not a child." << std::endl;
@@ -128,10 +173,11 @@
 
         // Remove old btCollisionShape, stored in the children map
         if (it->second)
-            this->compoundShape_->removeChildShape(it->second);
+            this->compoundShape_->removeChildShape(it->second); // TODO: Apparently this is broken?
+
+        // Only actually attach if we didn't pick a CompoundCollisionShape with no content
         if (shape->getCollisionShape())
         {
-            // Only actually attach if we didn't pick a CompoundCollisionShape with no content
             btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition()));
             this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
             it->second = shape->getCollisionShape();
@@ -140,44 +186,59 @@
         this->updatePublicShape();
     }
 
+    /**
+    @brief
+        Updates the public shape, the collision shape this CompoundCollisionShape has to the outside.
+    */
     void CompoundCollisionShape::updatePublicShape()
     {
-        btCollisionShape* primitive = 0;
-        bool bPrimitive = true;
-        bool bEmpty = true;
+        btCollisionShape* primitive = 0; // The primitive shape, if there is one.
+        bool bPrimitive = true; // Whether the CompoundCollisionShape has just one non-empty CollisionShape. And that shape also has no transformation.
+        bool bEmpty = true; // Whether the CompoundCollisionShape is empty.
+        // Iterate over all CollisionShapes that belong to this CompoundCollisionShape.
         for (std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)
         {
+            // TODO: Make sure this is correct.
             if (it->second)
             {
                 bEmpty = false;
-                if (!it->first->hasTransform() && !bPrimitive)
+                if (!it->first->hasTransform() && bPrimitive)
                     primitive = it->second;
                 else
+                {
                     bPrimitive = false;
+                    break;
+                }
             }
         }
+
+        // If there is no non-empty CollisionShape.
         if (bEmpty)
         {
+            // If there was none all along, nothing needs to be changed.
             if (this->collisionShape_ == 0)
-            {
-                this->collisionShape_ = 0;
                 return;
-            }
             this->collisionShape_ = 0;
         }
+        // If the CompoundCollisionShape is just a primitive.
+        // Only one shape to be added, no transform; return it directly.
         else if (bPrimitive)
-        {
-            // --> Only one shape to be added, no transform; return it directly
             this->collisionShape_ = primitive;
-        }
+        // Make sure we use the compound shape when returning a btCollisionShape.
         else
-        {
-            // Make sure we use the compound shape when returning a btCollisionShape
             this->collisionShape_ = this->compoundShape_;
-        }
+
         this->updateParent();
     }
 
+    /**
+    @brief
+        Get the attached CollisionShape at the given index.
+    @param index
+        The index of the desired CollisionShape.
+    @return
+        Returns a pointer to the attached CollisionShape at the given index.
+    */
     CollisionShape* CompoundCollisionShape::getAttachedShape(unsigned int index) const
     {
         unsigned int i = 0;
@@ -189,4 +250,24 @@
         }
         return 0;
     }
+
+    /**
+    @brief
+        Is called when the scale of the CompoundCollisionShape has changed.
+        Iterates over all attached CollisionShapes and scales them, then recomputes their compound shape.
+    */
+    void CompoundCollisionShape::changedScale()
+    {
+        CollisionShape::changedScale();
+
+        // Iterate through all attached CollisionShapes.
+        for(std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
+        {
+            // Rescale the CollisionShape.
+            it->first->setScale3D(this->getScale3D());
+            this->updateAttachedShape(it->first);
+        }
+
+        this->updatePublicShape();
+    }
 }

Modified: code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h
===================================================================
--- code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h	2011-05-08 21:45:32 UTC (rev 8422)
@@ -26,6 +26,12 @@
  *
  */
 
+/**
+    @file CompoundCollisionShape.h
+    @brief Definition of the CompoundCollisionShape class.
+    @ingroup Collisionshapes
+*/
+
 #ifndef _CompoundCollisionShape_H__
 #define _CompoundCollisionShape_H__
 
@@ -37,6 +43,16 @@
 
 namespace orxonox
 {
+
+    /**
+    @brief
+        Wrapper for the bullet compound collision shape class btCompoundShape.
+
+    @author
+        Reto Grieder
+
+    @ingroup Collisionshapes
+    */
     class _OrxonoxExport CompoundCollisionShape : public CollisionShape
     {
         public:
@@ -52,6 +68,8 @@
 
             void updateAttachedShape(CollisionShape* shape);
 
+            virtual void changedScale();
+
         private:
             void updatePublicShape();
             inline virtual btCollisionShape* createNewShape() const

Modified: code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc	2011-05-08 17:54:38 UTC (rev 8421)
+++ code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc	2011-05-08 21:45:32 UTC (rev 8422)
@@ -641,15 +641,12 @@
     */
     void WorldEntity::setScale3D(const Vector3& scale)
     {
-/*
-HACK HACK HACK
-        if (bScalePhysics && this->hasPhysics() && scale != Vector3::UNIT_SCALE)
+        // If physics is enabled scale the attached CollisionShape.
+        if (false && this->hasPhysics() && this->collisionShape_ != NULL)
         {
-            CCOUT(2) << "Warning: Cannot set the scale of a physical object: Not yet implemented. Ignoring scaling." << std::endl;
-            return;
+            this->collisionShape_->setScale3D(scale);
         }
-HACK HACK HACK
-*/
+
         this->node_->setScale(scale);
 
         this->changedScale();




More information about the Orxonox-commit mailing list