Index: /code/trunk/data/levels/collisionShapes.oxw
===================================================================
--- /code/trunk/data/levels/collisionShapes.oxw	(revision 10190)
+++ /code/trunk/data/levels/collisionShapes.oxw	(revision 10191)
@@ -34,9 +34,9 @@
 	<StaticEntity position="1000,0,0" collisionType="static">
 		<collisionShapes>
-			<SphereCollisionShape   position="0,-600,0" radius="100" />
-			<CylinderCollisionShape position="0,-300,0" radius="50" height="150" />
-			<BoxCollisionShape      position="0,-100,0" halfExtents="30, 50, 80" />
-			<ConeCollisionShape     position="0,+100,0" radius="50" height="150" />
-			<PlaneCollisionShape    position="0,+300,0" normal="0, -1, 0" offset="30" />
+			<SphereCollisionShape   yaw="20" pitch="20" roll="20" position="0,-300,0" radius="100" />
+			<CylinderCollisionShape yaw="20" pitch="20" roll="20" position="0,+000,0" radius="50" height="150" />
+			<BoxCollisionShape      yaw="20" pitch="20" roll="20" position="0,+200,0" halfExtents="30, 50, 80" />
+			<ConeCollisionShape     yaw="20" pitch="20" roll="20" position="0,+400,0" radius="50" height="150" />
+			<PlaneCollisionShape    yaw="20" pitch="20" roll="20" position="0,+600,0" normal="0, -1, 0" offset="30" />
 		</collisionShapes>
 	</StaticEntity>
Index: /code/trunk/src/libraries/tools/BulletDebugDrawer.cc
===================================================================
--- /code/trunk/src/libraries/tools/BulletDebugDrawer.cc	(revision 10190)
+++ /code/trunk/src/libraries/tools/BulletDebugDrawer.cc	(revision 10191)
@@ -59,10 +59,11 @@
     void BulletDebugDrawer::drawSphere(const btVector3& p, btScalar radius, const btVector3& color)
     {
-        this->drawer->drawSphere(vector3(p), radius, colour(color, 1.0f), true);
+        this->drawer->drawSphere(vector3(p), Ogre::Quaternion::IDENTITY, radius, colour(color, 1.0f), true);
     }
 
     void BulletDebugDrawer::drawSphere(btScalar radius, const btTransform& transform, const btVector3& color)
     {
-        this->drawSphere(transform.getOrigin(), radius, color);
+        Ogre::Matrix4 matrix = matrix4(transform);
+        this->drawer->drawSphere(matrix.getTrans(), matrix.extractQuaternion(), radius, colour(color, 1.0f), true);
     }
 
@@ -93,4 +94,16 @@
         corners[7]  = Ogre::Vector3(trans * btVector3(bbMax[0], bbMin[1], bbMax[2]));
         this->drawer->drawCuboid(corners, colour(color, 1.0f), true);
+    }
+
+    void BulletDebugDrawer::drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color)
+    {
+        Ogre::Matrix4 matrix = matrix4(transform);
+        this->drawer->drawCylinder(matrix.getTrans(), matrix.extractQuaternion(), radius, halfHeight * 2, colour(color, 1.0f), true);
+    }
+
+    void BulletDebugDrawer::drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color)
+    {
+        Ogre::Matrix4 matrix = matrix4(transform);
+        this->drawer->drawCone(matrix.getTrans(), matrix.extractQuaternion(), radius, height, colour(color, 1.0f), true);
     }
 
Index: /code/trunk/src/libraries/tools/BulletDebugDrawer.h
===================================================================
--- /code/trunk/src/libraries/tools/BulletDebugDrawer.h	(revision 10190)
+++ /code/trunk/src/libraries/tools/BulletDebugDrawer.h	(revision 10191)
@@ -26,6 +26,6 @@
             virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btVector3& color);
             virtual void drawBox(const btVector3& bbMin, const btVector3& bbMax, const btTransform& trans, const btVector3& color);
-//            virtual void drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color);
-//            virtual void drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color);
+            virtual void drawCylinder(btScalar radius, btScalar halfHeight, int upAxis, const btTransform& transform, const btVector3& color);
+            virtual void drawCone(btScalar radius, btScalar height, int upAxis, const btTransform& transform, const btVector3& color);
 //            virtual void drawPlane(const btVector3& planeNormal, btScalar planeConst, const btTransform& transform, const btVector3& color);
 
Index: /code/trunk/src/libraries/tools/DebugDrawer.cc
===================================================================
--- /code/trunk/src/libraries/tools/DebugDrawer.cc	(revision 10190)
+++ /code/trunk/src/libraries/tools/DebugDrawer.cc	(revision 10191)
@@ -84,5 +84,5 @@
     }
 
-    void DebugDrawer::buildCircle(const Ogre::Vector3& centre, float radius, int segmentsCount, const Ogre::ColourValue& colour, float alpha)
+    void DebugDrawer::buildCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, float alpha)
     {
         int index = linesIndex;
@@ -92,5 +92,5 @@
         for (int i = 0; i < segmentsCount; i++)
         {
-            addLineVertex(Ogre::Vector3(centre.x + radius * Ogre::Math::Cos(angle), centre.y, centre.z + radius * Ogre::Math::Sin(angle)),
+            addLineVertex(transform * Ogre::Vector3(radius * Ogre::Math::Cos(angle), 0, radius * Ogre::Math::Sin(angle)),
                     Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
             angle += increment;
@@ -101,5 +101,5 @@
     }
 
-    void DebugDrawer::buildFilledCircle(const Ogre::Vector3& centre, float radius, int segmentsCount, const Ogre::ColourValue& colour, float alpha)
+    void DebugDrawer::buildFilledCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, bool up, float alpha)
     {
         int index = trianglesIndex;
@@ -109,86 +109,83 @@
         for (int i = 0; i < segmentsCount; i++)
         {
-            addTriangleVertex(Ogre::Vector3(centre.x + radius * Ogre::Math::Cos(angle), centre.y, centre.z + radius * Ogre::Math::Sin(angle)),
+            addTriangleVertex(transform * Ogre::Vector3(radius * Ogre::Math::Cos(angle), 0, radius * Ogre::Math::Sin(angle)),
                     Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
             angle += increment;
         }
 
-        addTriangleVertex(centre, Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
-        for (int i = 0; i < segmentsCount; i++)
-            addTriangleIndices(i + 1 < segmentsCount ? index + i + 1 : index, index + i, index + segmentsCount);
-    }
-
-    void DebugDrawer::buildCylinder(const Ogre::Vector3& centre, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha)
+        addTriangleVertex(transform.getTrans(), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+        for (int i = 0; i < segmentsCount; i++)
+        {
+            if (up)
+                addTriangleIndices(i + 1 < segmentsCount ? index + i + 1 : index, index + i, index + segmentsCount);
+            else
+                addTriangleIndices(index + i, i + 1 < segmentsCount ? index + i + 1 : index, index + segmentsCount);
+        }
+    }
+
+    void DebugDrawer::buildCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha)
     {
         int index = linesIndex;
-        float increment = 2 * Ogre::Math::PI / segmentsCount;
-        float angle = 0.0f;
-
-        // Top circle
-        for (int i = 0; i < segmentsCount; i++)
-        {
-            addLineVertex(Ogre::Vector3(centre.x + radius * Ogre::Math::Cos(angle), centre.y + height / 2, centre.z + radius * Ogre::Math::Sin(angle)),
-                    Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-            angle += increment;
-        }
-
-        angle = 0.0f;
-
-        // Bottom circle
-        for (int i = 0; i < segmentsCount; i++)
-        {
-            addLineVertex(Ogre::Vector3(centre.x + radius * Ogre::Math::Cos(angle), centre.y - height / 2, centre.z + radius * Ogre::Math::Sin(angle)),
-                    Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-            angle += increment;
-        }
-
-        for (int i = 0; i < segmentsCount; i++)
-        {
-            addLineIndices(index + i, i + 1 < segmentsCount ? index + i + 1 : index);
-            addLineIndices(segmentsCount + index + i, i + 1 < segmentsCount ? segmentsCount + index + i + 1 : segmentsCount + index);
+
+        Ogre::Matrix4 transform(rotation);
+        transform.setTrans(centre + rotation * Ogre::Vector3(0, height / 2, 0));
+        this->buildCircle(transform, radius, segmentsCount, colour, alpha);
+        transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
+        this->buildCircle(transform, radius, segmentsCount, colour, alpha);
+
+        for (int i = 0; i < segmentsCount; i++)
             addLineIndices(index + i, segmentsCount + index + i);
-        }
-    }
-
-    void DebugDrawer::buildFilledCylinder(const Ogre::Vector3& centre, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour,
+    }
+
+    void DebugDrawer::buildFilledCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour,
             float alpha)
     {
         int index = trianglesIndex;
-        float increment = 2 * Ogre::Math::PI / segmentsCount;
-        float angle = 0.0f;
-
-        // Top circle
-        for (int i = 0; i < segmentsCount; i++)
-        {
-            addTriangleVertex(Ogre::Vector3(centre.x + radius * Ogre::Math::Cos(angle), centre.y + height / 2, centre.z + radius * Ogre::Math::Sin(angle)),
-                    Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-            angle += increment;
-        }
-
-        addTriangleVertex(Ogre::Vector3(centre.x, centre.y + height / 2, centre.z), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
-        angle = 0.0f;
-
-        // Bottom circle
-        for (int i = 0; i < segmentsCount; i++)
-        {
-            addTriangleVertex(Ogre::Vector3(centre.x + radius * Ogre::Math::Cos(angle), centre.y - height / 2, centre.z + radius * Ogre::Math::Sin(angle)),
-                    Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-            angle += increment;
-        }
-
-        addTriangleVertex(Ogre::Vector3(centre.x, centre.y - height / 2, centre.z), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
-
-        for (int i = 0; i < segmentsCount; i++)
-        {
-            addTriangleIndices(i + 1 < segmentsCount ? index + i + 1 : index, index + i, index + segmentsCount);
-
-            addTriangleIndices(i + 1 < segmentsCount ? (segmentsCount + 1) + index + i + 1 : (segmentsCount + 1) + index,
-                    (segmentsCount + 1) + index + segmentsCount, (segmentsCount + 1) + index + i);
-
+
+        Ogre::Matrix4 transform(rotation);
+        transform.setTrans(centre + rotation * Ogre::Vector3(0, height / 2, 0));
+        this->buildCircle(transform, radius, segmentsCount, colour, alpha);
+        this->buildFilledCircle(transform, radius, segmentsCount, colour, true, alpha);
+
+        transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
+        this->buildCircle(transform, radius, segmentsCount, colour, alpha);
+        this->buildFilledCircle(transform, radius, segmentsCount, colour, false, alpha);
+
+        for (int i = 0; i < segmentsCount; i++)
+        {
             addQuadIndices(index + i, i + 1 < segmentsCount ? index + i + 1 : index,
                     i + 1 < segmentsCount ? (segmentsCount + 1) + index + i + 1 : (segmentsCount + 1) + index, (segmentsCount + 1) + index + i);
         }
+    }
+
+    void DebugDrawer::buildCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha)
+    {
+        int index = linesIndex;
+
+        Ogre::Matrix4 transform(rotation);
+        transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
+        this->buildCircle(transform, radius, segmentsCount, colour, alpha);
+
+        addLineVertex(centre + rotation * Ogre::Vector3(0, height / 2, 0), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+        for (int i = 0; i < segmentsCount; i++)
+            addLineIndices(index + i, index + segmentsCount);
+    }
+
+    void DebugDrawer::buildFilledCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour,
+            float alpha)
+    {
+        int index = trianglesIndex;
+
+        Ogre::Matrix4 transform(rotation);
+        transform.setTrans(centre + rotation * Ogre::Vector3(0, -height / 2, 0));
+        this->buildCircle(transform, radius, segmentsCount, colour, alpha);
+        this->buildFilledCircle(transform, radius, segmentsCount, colour, false, alpha);
+
+        addTriangleVertex(centre + rotation * Ogre::Vector3(0, height / 2, 0), Ogre::ColourValue(colour.r, colour.g, colour.b, alpha));
+
+        for (int i = 0; i < segmentsCount; i++)
+            addTriangleIndices(index + i, index + segmentsCount + 1, i + 1 < segmentsCount ? index + i + 1 : index);
     }
 
@@ -301,16 +298,34 @@
     }
 
-    void DebugDrawer::drawCircle(const Ogre::Vector3& centre, float radius, int segmentsCount, const Ogre::ColourValue& colour, bool isFilled)
-    {
-        buildCircle(centre, radius, segmentsCount, colour);
-        if (isFilled)
-            buildFilledCircle(centre, radius, segmentsCount, colour, fillAlpha);
-    }
-
-    void DebugDrawer::drawCylinder(const Ogre::Vector3& centre, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, bool isFilled)
-    {
-        buildCylinder(centre, radius, segmentsCount, height, colour);
-        if (isFilled)
-            buildFilledCylinder(centre, radius, segmentsCount, height, colour, fillAlpha);
+    void DebugDrawer::drawCircle(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled)
+    {
+        int segmentsCount = std::min(100.0, radius / 2.5);
+
+        Ogre::Matrix4 transform(rotation);
+        transform.setTrans(centre);
+
+        buildCircle(transform, radius, segmentsCount, colour);
+        if (isFilled)
+            buildFilledCircle(transform, radius, segmentsCount, colour, fillAlpha);
+    }
+
+    void DebugDrawer::drawCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled)
+    {
+        int segmentsCount = std::min(100.0, radius / 2.5);
+
+        if (isFilled)
+            buildFilledCylinder(centre, rotation, radius, segmentsCount, height, colour, fillAlpha);
+        else
+            buildCylinder(centre, rotation, radius, segmentsCount, height, colour);
+    }
+
+    void DebugDrawer::drawCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled)
+    {
+        int segmentsCount = std::min(100.0, radius / 2.5);
+
+        if (isFilled)
+            buildFilledCone(centre, rotation, radius, segmentsCount, height, colour, fillAlpha);
+        else
+            buildCone(centre, rotation, radius, segmentsCount, height, colour);
     }
 
@@ -329,17 +344,23 @@
     }
 
-    void DebugDrawer::drawSphere(const Ogre::Vector3& centre, float radius, const Ogre::ColourValue& colour, bool isFilled)
+    void DebugDrawer::drawSphere(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled)
     {
         const IcoSphere& sphere = this->getIcoSphere(radius);
 
-        int baseIndex = linesIndex;
-        linesIndex += sphere.addToVertices(&lineVertices, centre, colour, radius);
-        sphere.addToLineIndices(baseIndex, &lineIndices);
-
-        if (isFilled)
-        {
-            baseIndex = trianglesIndex;
+        if (isFilled)
+        {
+            this->drawCircle(centre, rotation * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(1, 0, 0)), radius, colour, false);
+            this->drawCircle(centre, rotation * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(0, 1, 0)), radius, colour, false);
+            this->drawCircle(centre, rotation * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3(0, 0, 1)), radius, colour, false);
+
+            int baseIndex = trianglesIndex;
             trianglesIndex += sphere.addToVertices(&triangleVertices, centre, Ogre::ColourValue(colour.r, colour.g, colour.b, fillAlpha), radius);
             sphere.addToTriangleIndices(baseIndex, &triangleIndices);
+        }
+        else
+        {
+            int baseIndex = linesIndex;
+            linesIndex += sphere.addToVertices(&lineVertices, centre, colour, radius);
+            sphere.addToLineIndices(baseIndex, &lineIndices);
         }
     }
Index: /code/trunk/src/libraries/tools/DebugDrawer.h
===================================================================
--- /code/trunk/src/libraries/tools/DebugDrawer.h	(revision 10190)
+++ /code/trunk/src/libraries/tools/DebugDrawer.h	(revision 10191)
@@ -35,9 +35,11 @@
 
             void drawLine(const Ogre::Vector3& start, const Ogre::Vector3& end, const Ogre::ColourValue& colour);
-            void drawCircle(const Ogre::Vector3& centre, float radius, int segmentsCount, const Ogre::ColourValue& colour, bool isFilled = false);
-            void drawCylinder(const Ogre::Vector3& centre, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, bool isFilled = false);
+            void drawCircle(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled = false);
+            void drawCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled = false);
+            void drawCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, float height, const Ogre::ColourValue& colour, bool isFilled = false);
+
             void drawQuad(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, bool isFilled = false);
             void drawCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, bool isFilled = false);
-            void drawSphere(const Ogre::Vector3& centre, float radius, const Ogre::ColourValue& colour, bool isFilled = false);
+            void drawSphere(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, const Ogre::ColourValue& colour, bool isFilled = false);
             void drawTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, bool isFilled = false);
 
@@ -86,9 +88,12 @@
             void buildFilledCuboid(const Ogre::Vector3* vertices, const Ogre::ColourValue& colour, float alpha = 1.0f);
 
-            void buildCircle(const Ogre::Vector3& centre, float radius, int segmentsCount, const Ogre::ColourValue& colour, float alpha = 1.0f);
-            void buildFilledCircle(const Ogre::Vector3& centre, float radius, int segmentsCount, const Ogre::ColourValue& colour, float alpha = 1.0f);
+            void buildCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, float alpha = 1.0f);
+            void buildFilledCircle(const Ogre::Matrix4& transform, float radius, int segmentsCount, const Ogre::ColourValue& colour, bool up, float alpha = 1.0f);
 
-            void buildCylinder(const Ogre::Vector3& centre, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
-            void buildFilledCylinder(const Ogre::Vector3& centre, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
+            void buildCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
+            void buildFilledCylinder(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
+
+            void buildCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
+            void buildFilledCone(const Ogre::Vector3& centre, const Ogre::Quaternion& rotation, float radius, int segmentsCount, float height, const Ogre::ColourValue& colour, float alpha = 1.0f);
 
             void buildTetrahedron(const Ogre::Vector3& centre, float scale, const Ogre::ColourValue& colour, float alpha = 1.0f);
