Index: /code/branches/physics/src/ogrebullet/CMakeLists.txt
===================================================================
--- /code/branches/physics/src/ogrebullet/CMakeLists.txt	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/CMakeLists.txt	(revision 1971)
@@ -0,0 +1,48 @@
+SET( OGREBULLET_SRC_FILES
+  OgreBulletCollisionsObject.cpp
+  OgreBulletCollisionsObjectState.cpp
+  OgreBulletCollisionsRay.cpp
+  OgreBulletCollisionsShape.cpp
+  OgreBulletCollisionsWorld.cpp
+  
+  Debug/OgreBulletCollisionsDebugContanct.cpp
+  Debug/OgreBulletCollisionsDebugDrawer.cpp
+  Debug/OgreBulletCollisionsDebugLines.cpp
+  Debug/OgreBulletCollisionsDebugShape.cpp
+  
+  Shapes/OgreBulletCollisionsBoxShape.cpp
+  Shapes/OgreBulletCollisionsCapsuleShape.cpp
+  Shapes/OgreBulletCollisionsCompoundShape.cpp
+  Shapes/OgreBulletCollisionsConeShape.cpp
+  Shapes/OgreBulletCollisionsConvexHullShape.cpp
+  Shapes/OgreBulletCollisionsCylinderShape.cpp
+  Shapes/OgreBulletCollisionsGImpactShape.cpp
+  Shapes/OgreBulletCollisionsMinkowskiSumShape.cpp
+  Shapes/OgreBulletCollisionsMultiSphereShape.cpp
+  Shapes/OgreBulletCollisionsSphereShape.cpp
+  Shapes/OgreBulletCollisionsStaticPlaneShape.cpp
+  Shapes/OgreBulletCollisionsTriangleShape.cpp
+  Shapes/OgreBulletCollisionsTrimeshShape.cpp
+  
+  Utils/OgreBulletCollisionsMeshToShapeConverter.cpp
+  
+  
+  # Dynamic files depend on Collision source.
+  # They could be handled as two libraries.
+  OgreBulletDynamicsConstraint.cpp
+  OgreBulletDynamicsObjectState.cpp
+  OgreBulletDynamicsRigidBody.cpp
+  OgreBulletDynamicsWorld.cpp
+  
+  Contraints/OgreBulletDynamics6DofContraints.cpp
+  Contraints/OgreBulletDynamicsConeTwistContraint.cpp
+  Contraints/OgreBulletDynamicsHingeConstraint.cpp
+  Contraints/OgreBulletDynamicsPoint2pointContraint.cpp
+  Contraints/OgreBulletDynamicsRaycastVehicle.cpp
+  
+  Prefab/OgreBulletDynamicsRagDoll.cpp
+)
+
+INCLUDE_DIRECTORIES(.)
+
+ADD_LIBRARY(ogrebullet_orxonox STATIC ${OGREBULLET_SRC_FILES})
Index: /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamics6DofConstraint.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamics6DofConstraint.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamics6DofConstraint.cpp	(revision 1971)
@@ -0,0 +1,91 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletDynamics.h"
+
+#include "OgreBulletDynamicsWorld.h"
+#include "OgreBulletDynamicsRigidBody.h"
+
+#include "OgreBulletDynamicsConstraint.h"
+#include "Constraints/OgreBulletDynamics6DofConstraint.h"
+
+using namespace Ogre;
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    SixDofConstraint::SixDofConstraint(RigidBody * rbA, RigidBody * rbB, 
+        const Vector3& FrameInAVector3, const Quaternion& FrameInAOrientation,
+        const Vector3& FrameInBVector3, const Quaternion& FrameInBOrientation):
+    TypedConstraint(rbA, rbB)
+    {
+        btTransform frameInA (OgreBulletCollisions::OgreBtConverter::to (FrameInAOrientation), 
+                              OgreBulletCollisions::OgreBtConverter::to (FrameInAVector3));
+        btTransform frameInB (OgreBulletCollisions::OgreBtConverter::to (FrameInBOrientation),
+                              OgreBulletCollisions::OgreBtConverter::to (FrameInBVector3));
+
+        mConstraint = new btGeneric6DofConstraint(
+            *rbA->getBulletRigidBody (),
+            *rbB->getBulletRigidBody (), 
+            frameInA,
+            frameInB,
+			true); // Eric added this because Bullet 2.61 has a new argument (useLinearReferenceFrameA)
+    }
+    // -------------------------------------------------------------------------
+    SixDofConstraint::~SixDofConstraint()
+    {
+	}
+	// -------------------------------------------------------------------------
+	void	 SixDofConstraint::setLinearLowerLimit(const Ogre::Vector3& linearLower)
+	{
+		static_cast<btGeneric6DofConstraint* > (mConstraint)->setLinearLowerLimit(OgreBulletCollisions::OgreBtConverter::to (linearLower));
+	}
+	// -------------------------------------------------------------------------
+	void	 SixDofConstraint::setLinearUpperLimit(const Ogre::Vector3& linearUpper)
+	{
+		static_cast<btGeneric6DofConstraint* > (mConstraint)->setLinearLowerLimit(OgreBulletCollisions::OgreBtConverter::to (linearUpper));
+	}
+	// -------------------------------------------------------------------------
+	void	 SixDofConstraint::setAngularLowerLimit(const Ogre::Vector3& angularLower)
+	{
+		static_cast<btGeneric6DofConstraint* > (mConstraint)->setLinearLowerLimit(OgreBulletCollisions::OgreBtConverter::to (angularLower));
+	}
+	// -------------------------------------------------------------------------
+	void	 SixDofConstraint::setAngularUpperLimit(const Ogre::Vector3& angularUpper)
+	{
+		static_cast<btGeneric6DofConstraint* > (mConstraint)->setLinearLowerLimit(OgreBulletCollisions::OgreBtConverter::to (angularUpper));
+	}
+	// -------------------------------------------------------------------------
+	void	 SixDofConstraint::setLimit(const int axis, const Ogre::Real lo, const Ogre::Real hi)
+	{
+		static_cast<btGeneric6DofConstraint* > (mConstraint)->setLimit(axis, lo, hi);
+	}
+	// -------------------------------------------------------------------------
+	bool	 SixDofConstraint::isLimited(int limitIndex)
+	{
+		return static_cast<btGeneric6DofConstraint* > (mConstraint)->isLimited(limitIndex);
+	}
+}
Index: /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamics6DofConstraint.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamics6DofConstraint.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamics6DofConstraint.h	(revision 1971)
@@ -0,0 +1,65 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+#ifndef _OGREBULLETDYNAMICS_SixDofConstraint_H
+#define _OGREBULLETDYNAMICS_SixDofConstraint_H
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+#include "OgreBulletDynamicsConstraint.h"
+
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    // SixDofConstraint  class
+    class SixDofConstraint : public TypedConstraint
+    {
+    public:
+        SixDofConstraint(RigidBody * rbA, RigidBody * rbB, 
+            const Ogre::Vector3& FrameInAVector, const Ogre::Quaternion& FrameInAOrientation,
+            const Ogre::Vector3& FrameInBVector, const Ogre::Quaternion& FrameInBOrientation);
+
+		void	setLinearLowerLimit(const Ogre::Vector3& linearLower);
+		void	setLinearUpperLimit(const Ogre::Vector3& linearUpper);
+		void	setAngularLowerLimit(const Ogre::Vector3& angularLower);
+		void	setAngularUpperLimit(const Ogre::Vector3& angularUpper);
+
+		void	setLimit(const int axis, const Ogre::Real lo, const Ogre::Real hi);
+		//! Test limit
+		/*!
+		- free means upper < lower,
+		- locked means upper == lower
+		- limited means upper > lower
+		- limitIndex: first 3 are linear, next 3 are angular
+		*/
+		bool	 isLimited(int limitIndex);
+
+        virtual ~SixDofConstraint();
+
+    };
+}
+#endif //_OGREBULLETDYNAMICS_SixDofConstraint_H
+
Index: /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsConeTwistConstraint.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsConeTwistConstraint.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsConeTwistConstraint.cpp	(revision 1971)
@@ -0,0 +1,59 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper) For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+    file added by rtti (at) elane2k (dot) com
+
+This program is free software; you can redistribute it and/or modify it under the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+----------------------------------------------------------------------------
+-
+*/
+
+#include "OgreBulletDynamics.h"
+
+#include "OgreBulletDynamicsWorld.h"
+#include "OgreBulletDynamicsRigidBody.h"
+
+#include "OgreBulletDynamicsConstraint.h"
+#include "Constraints/OgreBulletDynamicsConeTwistConstraint.h"
+
+using namespace Ogre;
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    ConeTwistConstraint::ConeTwistConstraint(RigidBody * rbA, RigidBody * rbB,
+        const Vector3& FrameInAVector3, const Quaternion& FrameInAOrientation,
+        const Vector3& FrameInBVector3, const Quaternion& FrameInBOrientation):
+    TypedConstraint(rbA, rbB)
+    {
+        btTransform frameInA (OgreBulletCollisions::OgreBtConverter::to(FrameInAOrientation),
+                              OgreBulletCollisions::OgreBtConverter::to(FrameInAVector3));
+        btTransform frameInB (OgreBulletCollisions::OgreBtConverter::to(FrameInBOrientation),
+                              OgreBulletCollisions::OgreBtConverter::to(FrameInBVector3));
+
+        mConstraint = new btConeTwistConstraint(
+            *rbA->getBulletRigidBody (),
+            *rbB->getBulletRigidBody (),
+            frameInA,
+            frameInB);
+    }
+    //-------------------------------------------------------------------------
+    ConeTwistConstraint::~ConeTwistConstraint()
+    {
+    }
+   
+    void ConeTwistConstraint::setLimit(Ogre::Real a, Ogre::Real b, Ogre::Real c)
+    {
+        dynamic_cast<btConeTwistConstraint*>(mConstraint)->setLimit(a,b,c);
+    }
+   
+}
+
Index: /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsConeTwistConstraint.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsConeTwistConstraint.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsConeTwistConstraint.h	(revision 1971)
@@ -0,0 +1,43 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper) For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+    file added by rtti (at) elane2k (dot) com
+
+This program is free software; you can redistribute it and/or modify it under the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+----------------------------------------------------------------------------
+-
+*/
+#ifndef _OGREBULLETDYNAMICS_ConeTwistConstraint_H
+#define _OGREBULLETDYNAMICS_ConeTwistConstraint_H
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+#include "OgreBulletDynamicsConstraint.h"
+
+
+namespace OgreBulletDynamics
+{
+    //-------------------------------------------------------------------------
+    // ConeTwistConstraint  class
+    class ConeTwistConstraint : public TypedConstraint
+    {
+    public:
+        ConeTwistConstraint(RigidBody * rbA, RigidBody * rbB,
+            const Ogre::Vector3& FrameInAVector, const Ogre::Quaternion& FrameInAOrientation,
+            const Ogre::Vector3& FrameInBVector, const Ogre::Quaternion& FrameInBOrientation);
+
+        virtual ~ConeTwistConstraint();
+       
+        void setLimit(Ogre::Real a, Ogre::Real b, Ogre::Real c);
+
+    };
+}
+#endif //_OGREBULLETDYNAMICS_ConeTwistConstraint_H
Index: /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsHingeConstraint.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsHingeConstraint.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsHingeConstraint.cpp	(revision 1971)
@@ -0,0 +1,84 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletDynamics.h"
+
+#include "OgreBulletDynamicsWorld.h"
+#include "OgreBulletDynamicsRigidBody.h"
+#include "OgreBulletDynamicsConstraint.h"
+#include "Constraints/OgreBulletDynamicsHingeConstraint.h"
+
+using namespace Ogre;
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    HingeConstraint::HingeConstraint(RigidBody * rbA, RigidBody * rbB, const Vector3& pivotInA,
+        const Vector3& pivotInB, const Vector3& axisInA, const Vector3& axisInB):
+        TypedConstraint(rbA, rbB)
+    {
+        btVector3 vec[4];
+        vec[0] = OgreBulletCollisions::OgreBtConverter::to(pivotInA);
+        vec[1] = OgreBulletCollisions::OgreBtConverter::to(pivotInB);
+        vec[2] = OgreBulletCollisions::OgreBtConverter::to(axisInA);
+        vec[3] = OgreBulletCollisions::OgreBtConverter::to(axisInB);
+       
+        mConstraint = new btHingeConstraint(
+            *rbA->getBulletRigidBody (),
+            *rbB->getBulletRigidBody (),
+            vec[0], vec[1], vec[2], vec[3]);
+/*
+        mConstraint = new btHingeConstraint(
+            *rbA->getBulletRigidBody (),
+            *rbB->getBulletRigidBody (), 
+            OgreBulletCollisions::OgreBtConverter::to(pivotInA),
+            OgreBulletCollisions::OgreBtConverter::to(pivotInB), 
+            OgreBulletCollisions::OgreBtConverter::to(axisInA), 
+            OgreBulletCollisions::OgreBtConverter::to(axisInB));*/
+    }
+    // -------------------------------------------------------------------------
+        HingeConstraint::HingeConstraint(RigidBody * rbA, 
+            const Vector3& pivotInA, 
+            const Vector3&  axisInA):
+    TypedConstraint(rbA)
+    {
+        btVector3 vec[2];
+        vec[0] = OgreBulletCollisions::OgreBtConverter::to(pivotInA);
+        vec[1] = OgreBulletCollisions::OgreBtConverter::to(axisInA);
+
+        mConstraint = new btHingeConstraint(*rbA->getBulletRigidBody (),
+            vec[0], vec[1]);
+
+/*
+        mConstraint = new btHingeConstraint(*rbA->getBulletRigidBody (),
+            OgreBulletCollisions::OgreBtConverter::to(pivotInA),
+            OgreBulletCollisions::OgreBtConverter::to(axisInA));*/
+    }
+    // -------------------------------------------------------------------------
+    HingeConstraint::~HingeConstraint()
+    {
+    }
+}
Index: /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsHingeConstraint.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsHingeConstraint.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsHingeConstraint.h	(revision 1971)
@@ -0,0 +1,57 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+#ifndef _OGREBULLETDYNAMICS_HingeConstraint_H
+#define _OGREBULLETDYNAMICS_HingeConstraint_H
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+#include "OgreBulletDynamicsConstraint.h"
+
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    // HingeConstraint  class
+    class HingeConstraint : public TypedConstraint
+    {
+    public:
+        HingeConstraint(RigidBody * rbA, 
+                            RigidBody * rbB, 
+                            const Ogre::Vector3& pivotInA,
+                            const Ogre::Vector3& pivotInB, 
+                            const Ogre::Vector3& axisInA, 
+                            const Ogre::Vector3& axisInB);
+        HingeConstraint(RigidBody * rbA, 
+            const Ogre::Vector3& pivotInA, 
+            const Ogre::Vector3&  axisInA);
+
+
+        virtual ~HingeConstraint();
+
+    };
+}
+#endif //_OGREBULLETDYNAMICS_HingeConstraint_H
+
Index: /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsPoint2pointConstraint.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsPoint2pointConstraint.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsPoint2pointConstraint.cpp	(revision 1971)
@@ -0,0 +1,81 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletDynamics.h"
+
+#include "OgreBulletDynamicsWorld.h"
+#include "OgreBulletDynamicsRigidBody.h"
+#include "OgreBulletDynamicsConstraint.h"
+#include "Constraints/OgreBulletDynamicsPoint2pointConstraint.h"
+
+using namespace Ogre;
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    PointToPointConstraint::PointToPointConstraint(RigidBody *body, const Vector3 &pivot) :
+        TypedConstraint(body)
+    {
+        mConstraint = new btPoint2PointConstraint(*(body->getBulletRigidBody ()), 
+            OgreBulletCollisions::OgreBtConverter::to(pivot));
+    }
+    // -------------------------------------------------------------------------
+    PointToPointConstraint::~PointToPointConstraint()
+    {
+    }
+    // -------------------------------------------------------------------------
+    void	PointToPointConstraint::setPivotA(const Ogre::Vector3& pivotA)
+    {
+        getBulletPoint2PointConstraint()->setPivotA(
+            OgreBulletCollisions::OgreBtConverter::to(pivotA));
+    }
+    // -------------------------------------------------------------------------
+    void	PointToPointConstraint::setPivotB(const Ogre::Vector3& pivotB)
+    {
+        getBulletPoint2PointConstraint()->setPivotB(
+            OgreBulletCollisions::OgreBtConverter::to(pivotB));
+    }
+    // -------------------------------------------------------------------------
+    void PointToPointConstraint::setTau (float tau) 
+    {
+        getBulletPoint2PointConstraint()->m_setting.m_tau = tau;
+    };
+    // -------------------------------------------------------------------------
+    void PointToPointConstraint::setDamping (float damping) 
+    {
+        getBulletPoint2PointConstraint()->m_setting.m_damping = damping;
+    };
+    // -------------------------------------------------------------------------
+    float PointToPointConstraint::getTau () const 
+    {
+        return getBulletPoint2PointConstraint()->m_setting.m_tau;
+    };
+    // -------------------------------------------------------------------------
+    float PointToPointConstraint::getDamping () const 
+    {
+        return getBulletPoint2PointConstraint()->m_setting.m_damping;
+    };
+}
Index: /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsPoint2pointConstraint.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsPoint2pointConstraint.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsPoint2pointConstraint.h	(revision 1971)
@@ -0,0 +1,67 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+#ifndef _OGREBULLETDYNAMICS_PointTopointConstraint_H
+#define _OGREBULLETDYNAMICS_PointTopointConstraint_H
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+#include "OgreBulletDynamicsConstraint.h"
+
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    // PointTopointConstraint  class
+    class PointToPointConstraint : public TypedConstraint
+    {
+    public:
+	    PointToPointConstraint(RigidBody *body, const Ogre::Vector3 &pivot);
+
+	    virtual ~PointToPointConstraint();
+
+        inline btPoint2PointConstraint * getBulletPoint2PointConstraint () const;
+
+        void setTau (float tau);
+        void setDamping (float damping);
+
+        float getTau () const;
+        float getDamping () const;
+
+
+        void	setPivotA(const Ogre::Vector3& pivotA);
+        void	setPivotB(const Ogre::Vector3& pivotB);
+
+    };
+    // -------------------------------------------------------------------------
+    // inline PointTopointConstraint  class methods
+    // -------------------------------------------------------------------------
+    inline btPoint2PointConstraint * PointToPointConstraint::getBulletPoint2PointConstraint () const 
+    {
+        return static_cast <btPoint2PointConstraint *> (mConstraint);
+    }
+}
+#endif //_OGREBULLETDYNAMICS_PointTopointConstraint_H
+
Index: /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsRaycastVehicle.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsRaycastVehicle.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsRaycastVehicle.cpp	(revision 1971)
@@ -0,0 +1,183 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletDynamics.h"
+
+#include "OgreBulletDynamicsWorld.h"
+#include "OgreBulletDynamicsRigidBody.h"
+#include "OgreBulletDynamicsConstraint.h"
+#include "Constraints/OgreBulletDynamicsRaycastVehicle.h"
+
+using namespace Ogre;
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    VehicleRayCaster::VehicleRayCaster(DynamicsWorld *world)
+    {
+        mBulletVehicleRayCaster = new btDefaultVehicleRaycaster(world->getBulletDynamicsWorld ());
+    }
+    // -------------------------------------------------------------------------
+    VehicleRayCaster::~VehicleRayCaster()
+    {
+        delete mBulletVehicleRayCaster;
+    }   
+    // -------------------------------------------------------------------------
+    VehicleTuning::VehicleTuning(const Ogre::Real suspensionStiffness,
+				const Ogre::Real suspensionCompression,
+				const Ogre::Real suspensionDamping,
+				const Ogre::Real maxSuspensionTravelCm,
+				const Ogre::Real frictionSlip)
+    {
+        mBulletTuning = new btRaycastVehicle::btVehicleTuning();
+
+        mBulletTuning->m_suspensionStiffness =  suspensionStiffness;
+        mBulletTuning->m_suspensionCompression = suspensionCompression;
+        mBulletTuning->m_suspensionDamping = suspensionDamping;
+        mBulletTuning->m_maxSuspensionTravelCm = maxSuspensionTravelCm;
+        mBulletTuning->m_frictionSlip = frictionSlip;
+    }
+    // -------------------------------------------------------------------------
+    VehicleTuning::~VehicleTuning()
+    {
+    }
+    // -------------------------------------------------------------------------
+    RaycastVehicle::RaycastVehicle(WheeledRigidBody *body,  
+                                VehicleTuning *vt,
+                                VehicleRayCaster *caster) :
+        TypedConstraint(body),
+        mTuning(vt),
+        mRayCaster(caster)
+    {
+        if (mRayCaster == 0)
+            mRayCaster = new VehicleRayCaster(mWorld);
+
+        btRaycastVehicle *v = new btRaycastVehicle(
+                *(mTuning->getBulletTuning()),
+                body->getBulletRigidBody (), 
+                mRayCaster->getBulletVehicleRayCaster()
+                );
+        mConstraint = v;
+        mWorld->addVehicle(this);
+        body->setVehicle (this);
+    }
+    // -------------------------------------------------------------------------
+    RaycastVehicle::~RaycastVehicle()
+    {
+    }
+    // -------------------------------------------------------------------------
+    void RaycastVehicle::setCoordinateSystem(int rightIndex,int upIndex,int forwardIndex)
+    {
+        getBulletVehicle()->setCoordinateSystem(rightIndex, upIndex, forwardIndex);
+    }
+    // -------------------------------------------------------------------------
+    void RaycastVehicle::addWheel(SceneNode *node,
+                                  const Ogre::Vector3 &connectionPoint,
+                                  const Ogre::Vector3 &wheelDirection,
+                                  const Ogre::Vector3 &wheelAxle,
+
+                                  const Ogre::Real suspensionRestLength,
+                                  const Ogre::Real wheelRadius,
+                                  const bool isFrontWheel,
+                                  
+                                  const Ogre::Real wheelFriction,
+                                  const Ogre::Real rollInfluence)
+    {
+        btRaycastVehicle *v = static_cast<btRaycastVehicle *> (mConstraint);
+
+        mWheelsInfo.push_back (
+            &v->addWheel(OgreBulletCollisions::OgreBtConverter::to(connectionPoint),
+                        OgreBulletCollisions::OgreBtConverter::to(wheelDirection),
+                        OgreBulletCollisions::OgreBtConverter::to(wheelAxle),
+                        suspensionRestLength,
+                        wheelRadius, 
+                        *(mTuning->getBulletTuning ()),
+                        isFrontWheel));
+
+        {
+            const size_t wheelCurrent = mWheelsInfo.size() - 1;
+            mWheelsInfo[wheelCurrent]->m_suspensionStiffness = mTuning->getBulletTuning()->m_suspensionStiffness;
+            mWheelsInfo[wheelCurrent]->m_wheelsDampingRelaxation = mTuning->getBulletTuning()->m_suspensionDamping;
+            mWheelsInfo[wheelCurrent]->m_wheelsDampingCompression = mTuning->getBulletTuning()->m_suspensionCompression;
+
+            mWheelsInfo[wheelCurrent]->m_frictionSlip = wheelFriction;
+            mWheelsInfo[wheelCurrent]->m_rollInfluence = rollInfluence;
+        }
+
+        // create wheel scene Node
+        {
+            node->setPosition (connectionPoint);
+
+            mWheelNodes.push_back ( node);
+            const size_t wheelCurrent = mWheelsInfo.size() - 1;
+
+            //mWheelsInfo[wheelCurrent]->
+        }
+    }
+    // -------------------------------------------------------------------------
+    void RaycastVehicle::setWheelsAttached()
+    {
+        btRaycastVehicle *v = static_cast<btRaycastVehicle *> (mConstraint);
+        for (int i=0; i < v->getNumWheels(); i++)
+        {
+            btWheelInfo& wheel = v->getWheelInfo(i);
+
+            wheel.m_suspensionStiffness = mTuning->getBulletTuning()->m_suspensionStiffness;
+            wheel.m_wheelsDampingRelaxation = mTuning->getBulletTuning()->m_suspensionDamping;
+            wheel.m_wheelsDampingCompression = mTuning->getBulletTuning()->m_suspensionCompression;
+
+            //wheel.m_frictionSlip = mBulletTuning->getBulletTuning()->m_wheelFriction;
+            //wheel.m_rollInfluence = mBulletTuning->getBulletTuning()->m_rollInfluence;
+        }
+    }
+    // -------------------------------------------------------------------------
+    void RaycastVehicle::setTransform()
+    {
+        //should update wheels as well ?
+        for (int i=0; i < getBulletVehicle()->getNumWheels(); i++)
+        {
+            //synchronize the wheels with the (interpolated) chassis world transform
+            getBulletVehicle()->updateWheelTransform(i, true);
+            //draw wheels (cylinders)
+            const btTransform &w = getBulletVehicle()->getWheelInfo(i).m_worldTransform;
+
+            mWheelNodes[i]->setPosition (w.getOrigin()[0], w.getOrigin()[1], w.getOrigin()[2]);
+            mWheelNodes[i]->setOrientation (w.getRotation().getW(), w.getRotation().getX(), w.getRotation().getY(), w.getRotation().getZ());
+
+        }
+    }
+    // -------------------------------------------------------------------------
+    void RaycastVehicle::applyEngineForce (float engineForce, int wheel)
+    {
+        getBulletVehicle()->applyEngineForce (engineForce, wheel);
+    }
+    // -------------------------------------------------------------------------
+    void RaycastVehicle::setSteeringValue(float steering, int wheel)
+    {
+        getBulletVehicle()->setSteeringValue (steering, wheel);
+    }
+    // -------------------------------------------------------------------------
+}
Index: /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsRaycastVehicle.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsRaycastVehicle.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Constraints/OgreBulletDynamicsRaycastVehicle.h	(revision 1971)
@@ -0,0 +1,132 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+#ifndef _OGREBULLETDYNAMICS_RaycastVehicle_H
+#define _OGREBULLETDYNAMICS_RaycastVehicle_H
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+#include "OgreBulletDynamicsConstraint.h"
+
+
+namespace OgreBulletDynamics
+{
+
+    // -------------------------------------------------------------------------
+    // VehicleRayCaster  class
+    class VehicleRayCaster
+    {
+    public:
+        VehicleRayCaster(DynamicsWorld *world);
+        virtual ~VehicleRayCaster();
+        
+        btVehicleRaycaster *getBulletVehicleRayCaster()
+        {return static_cast <btVehicleRaycaster*> (mBulletVehicleRayCaster);};
+         
+    private:
+        btDefaultVehicleRaycaster *mBulletVehicleRayCaster;        
+    };
+    // -------------------------------------------------------------------------
+    // VehicleTuning  class
+    class VehicleTuning
+    {
+    public:
+        VehicleTuning(
+            const Ogre::Real suspensionStiffness,
+            const Ogre::Real suspensionCompression,
+            const Ogre::Real suspensionDamping,
+            const Ogre::Real maxSuspensionTravelCm,
+            const Ogre::Real frictionSlip);
+        virtual ~VehicleTuning();
+        
+        btRaycastVehicle::btVehicleTuning *getBulletTuning()
+        {return mBulletTuning;};
+        
+    private:
+        btRaycastVehicle::btVehicleTuning *mBulletTuning;        
+    };
+    // -------------------------------------------------------------------------
+    // RaycastVehicle  class
+    class WheelInfo
+    {
+    public:
+        WheelInfo(btWheelInfo &w): 
+          mWheel(&w)
+          {};
+        virtual ~WheelInfo(){};
+
+        btWheelInfo *getBulletWheelInfo(){return static_cast<btWheelInfo *> (mWheel);}
+       
+    protected:
+        btWheelInfo                   *mWheel;
+    };
+    // -------------------------------------------------------------------------
+    // RaycastVehicle  class
+    class RaycastVehicle : public TypedConstraint
+    {
+    public:
+        RaycastVehicle(WheeledRigidBody *body,  
+            VehicleTuning        *vt,
+            VehicleRayCaster     *caster = 0);
+
+        virtual ~RaycastVehicle();
+
+        btRaycastVehicle *getBulletVehicle()
+        {return static_cast<btRaycastVehicle *> (mConstraint);};
+        void setCoordinateSystem(int rightIndex,int upIndex,int forwardIndex);
+
+        void addWheel(
+            Ogre::SceneNode *node,
+            const Ogre::Vector3 &connectionPoint,
+            const Ogre::Vector3 &wheelDirection,
+            const Ogre::Vector3 &wheelAxle,
+            const Ogre::Real suspensionRestLength,
+            const Ogre::Real wheelRadius,
+            const bool isFrontWheel,
+            const Ogre::Real wheelFriction,
+            const Ogre::Real rollInfluence);
+
+        // when all wheels are attached, make vehicle aware of it
+        void setWheelsAttached();
+        // update wheels when needed.
+        void setTransform();
+
+        void applyEngineForce (float engineForce, int wheel);
+        void setSteeringValue(float steering, int wheel);
+
+     protected:
+         VehicleTuning                   *mTuning;
+         VehicleRayCaster                *mRayCaster;
+    
+         std::vector<btWheelInfo *>         mWheelsInfo;
+         std::vector<Ogre::SceneNode *>      mWheelNodes;
+
+         WheeledRigidBody* mChassisBody;
+         Ogre::SceneNode *mNode;
+         
+    };
+}
+#endif //_OGREBULLETDYNAMICS_RaycastVehicle_H
+
Index: /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugContact.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugContact.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugContact.cpp	(revision 1971)
@@ -0,0 +1,650 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+
+#include "OgreBulletCollisions.h"
+
+#include "Ogre.h"
+#include "OgreFontManager.h"
+
+#include "Debug/OgreBulletCollisionsDebugContact.h"
+#include "OgreBulletCollisionsShape.h"
+#include "OgreBulletCollisionsObject.h"
+#include "OgreBulletCollisionsWorld.h"
+
+using namespace Ogre;
+
+#define POS_TEX_BINDING    0
+#define COLOUR_BINDING     1
+
+namespace OgreBulletCollisions
+{
+    //------------------------------------------------------------------------------------------------
+    DebugContact::DebugContact(const String &name, CollisionsWorld *world) : 
+        _name(name), 
+        _world(world),
+        _enabled(false)
+    {
+        // scene node 
+        _node = _world->getSceneManager()->getRootSceneNode ()->createChildSceneNode ();
+
+        // sphere attach to contact point
+        _point = _world->getSceneManager()->createEntity(name + String("_debug_point"), "sphere.mesh");
+        _point_node = _node->createChildSceneNode ();
+        _point_node->attachObject (_point);
+        _point_node->setScale(0.001, 0.001, 0.001);
+
+        // normal direction debug
+         _normal = new DebugNormal();
+         _node->attachObject (_normal);
+
+         // text info on contact
+        _text = new DebugContactText(name + String("_debug_text"), _node->createChildSceneNode ());
+        _text->setPosition (Vector3(0,5,0));
+        _text->setCaption ("-");
+        _text->setVisible (false);
+
+        _node->setVisible (false);
+    }
+     //------------------------------------------------------------------------------------------------
+    DebugContact::~DebugContact()
+    {
+        delete _text;
+
+        _point_node->detachObject (_point->getName ());
+        _node->detachObject (_normal->getName ());
+
+        _world->getSceneManager()->destroyEntity (_point->getName ());
+
+        _node->detachAllObjects ();
+        _node->removeAndDestroyAllChildren ();
+
+        delete _normal;
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContact::update(const Ogre::Vector3 &normal, const Ogre::Vector3 &pt, const Ogre::Real depth)
+    {
+        _node->setPosition (pt);
+
+        _point_node->setPosition (depth * normal);
+
+        //String contactLabel("p: ");
+        //contactLabel = contactLabel + StringConverter::toString(contact->getPosition());
+        //contactLabel = contactLabel + ", n: ";
+        //contactLabel = contactLabel + StringConverter::toString(contact->getNormal());
+        //_text->setCaption (contactLabel);
+        //_text->setVisible (false);
+
+        //_text->setPosition (contact->getPosition () + Vector3(0,5,0));
+        
+        _normal->update (normal, pt, depth);
+    }
+    //------------------------------------------------------------------------------------------------
+    bool DebugContact::isEnabled () const 
+    {
+        return _enabled;
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContact::setEnabled (bool enable)
+    {
+        _enabled = enable;
+        _node->setVisible (_enabled);
+    };
+    //------------------------------------------------------------------------------------------------
+    void DebugNormal::update(const Ogre::Vector3 &normal, const Ogre::Vector3 &pt, const Ogre::Real depth)
+    {
+       DebugLines::clear ();
+       // set normal following contact normal
+       //contact->_normal 
+       //contact->_position
+       DebugLines::addLine (Vector3::ZERO, 
+                            5*normal);
+        DebugLines::draw ();
+    }
+    //------------------------------------------------------------------------------------------------
+    DebugContactText::DebugContactText(const String &name, 
+                                SceneNode *node,
+                                const String &caption, 
+                                const String &fontName, 
+                                int charHeight, 
+                                const ColourValue &color)
+        : mpCam(NULL)
+        , mpWin(NULL)
+        , mpFont(NULL)
+        , mName(name)
+        , mCaption(caption)
+        , mFontName(fontName)
+        , mCharHeight(charHeight)
+        , mColor(color)
+        , mType("DebugContact")
+        , mTimeUntilNextToggle(0)
+        , mSpaceWidth(0)
+        , mUpdateColors(true)
+        , mOnTop(false)
+        , mHorizontalAlignment(H_LEFT)
+        , mVerticalAlignment(V_BELOW)
+        , mAdditionalHeight(0.0)
+        , mNode(node)
+
+    {
+        if (name.empty())
+            Exception(Exception::ERR_INVALIDPARAMS, "Trying to create DebugContact without name", "DebugContact::DebugContact");
+// 
+//         if (caption.empty())
+//            Exception(Exception::ERR_INVALIDPARAMS, "Trying to create DebugContact without caption", "DebugContact::DebugContact");
+
+        mRenderOp.vertexData = NULL;
+        this->setFontName(mFontName);
+        //this->_setupGeometry();
+        mNode->attachObject(this);
+    }
+    //------------------------------------------------------------------------------------------------
+    DebugContactText::~DebugContactText()
+    {
+        mNode->detachObject(this->getName());
+        if (mRenderOp.vertexData)
+            delete mRenderOp.vertexData;
+    }
+#if (OGRE_VERSION >=  ((1 << 16) | (5 << 8) | 0)) // must have at least shoggoth (1.5.0)
+	void DebugContactText::visitRenderables(Renderable::Visitor* visitor, 
+		bool debugRenderables)
+	{
+		visitor->visit(this, 0, false);
+	}
+#endif
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::setPosition(const Vector3 &pos)
+    {
+        mNode->setPosition (pos);
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::setFontName(const String &fontName)
+    {
+        if((Ogre::MaterialManager::getSingletonPtr()->resourceExists(mName + "Material"))) 
+        { 
+            Ogre::MaterialManager::getSingleton().remove(mName + "Material"); 
+        }
+
+        if (mFontName != fontName || mpMaterial.isNull() || !mpFont)
+        {
+            mFontName = fontName;
+            mpFont = (Font *)FontManager::getSingleton().getByName(mFontName).getPointer();
+            if (!mpFont)
+                Exception(Exception::ERR_ITEM_NOT_FOUND, "Could not find font " + fontName, "DebugContact::setFontName");
+
+            mpFont->load();
+            if (!mpMaterial.isNull())
+            {
+                MaterialManager::getSingletonPtr()->remove(mpMaterial->getName());
+                mpMaterial.setNull();
+            }
+
+            mpMaterial = mpFont->getMaterial()->clone(mName + "Material");
+            if (!mpMaterial->isLoaded())
+                mpMaterial->load();
+
+            mpMaterial->setDepthCheckEnabled(!mOnTop);
+            //mpMaterial->setDepthBias(!mOnTop);
+            mpMaterial->setDepthBias(0,!mOnTop);
+            mpMaterial->setDepthWriteEnabled(mOnTop);
+            mpMaterial->setLightingEnabled(false);
+            mNeedUpdate = true;
+        }
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::setCaption(const String &caption)
+    {
+        if (caption != mCaption)
+        {
+            mCaption = caption;
+            mNeedUpdate = true;
+        }
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::setColor(const ColourValue &color)
+    {
+        if (color != mColor)
+        {
+            mColor = color;
+            mUpdateColors = true;
+        }
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::setCharacterHeight(unsigned int height)
+    {
+        if (height != mCharHeight)
+        {
+            mCharHeight = height;
+            mNeedUpdate = true;
+        }
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::setSpaceWidth(unsigned int width)
+    {
+        if (width != mSpaceWidth)
+        {
+            mSpaceWidth = width;
+            mNeedUpdate = true;
+        }
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::setTextAlignment(const HorizontalAlignment& horizontalAlignment, const VerticalAlignment& verticalAlignment)
+    {
+        if(mHorizontalAlignment != horizontalAlignment)
+        {
+            mHorizontalAlignment = horizontalAlignment;
+            mNeedUpdate = true;
+        }
+        if(mVerticalAlignment != verticalAlignment)
+        {
+            mVerticalAlignment = verticalAlignment;
+            mNeedUpdate = true;
+        }
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::setAdditionalHeight( Real height )
+    {
+        if( mAdditionalHeight != height )
+        {
+            mAdditionalHeight = height;
+            mNeedUpdate = true;
+        }
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::showOnTop(bool show)
+    {
+        if( mOnTop != show && !mpMaterial.isNull() )
+        {
+            mOnTop = show;
+            mpMaterial->setDepthBias(0,!mOnTop);
+            mpMaterial->setDepthCheckEnabled(!mOnTop);
+            mpMaterial->setDepthWriteEnabled(mOnTop);
+        }
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::_setupGeometry()
+    {
+        assert(mpFont);
+        assert(!mpMaterial.isNull());
+
+        unsigned int vertexCount = static_cast<unsigned int>(mCaption.size() * 6);
+
+        if (mRenderOp.vertexData)
+        {
+            // Removed this test as it causes problems when replacing a caption
+            // of the same size: replacing "Hello" with "hello"
+            // as well as when changing the text alignment
+            //if (mRenderOp.vertexData->vertexCount != vertexCount)
+            {
+                delete mRenderOp.vertexData;
+                mRenderOp.vertexData = NULL;
+                mUpdateColors = true;
+            }
+        }
+
+        if (!mRenderOp.vertexData)
+            mRenderOp.vertexData = new VertexData();
+
+        mRenderOp.indexData = 0;
+        mRenderOp.vertexData->vertexStart = 0;
+        mRenderOp.vertexData->vertexCount = vertexCount;
+        mRenderOp.operationType = RenderOperation::OT_TRIANGLE_LIST; 
+        mRenderOp.useIndexes = false; 
+
+        VertexDeclaration  *decl = mRenderOp.vertexData->vertexDeclaration;
+        VertexBufferBinding   *bind = mRenderOp.vertexData->vertexBufferBinding;
+        size_t offset = 0;
+
+        // create/bind positions/tex.ccord. buffer
+        if (!decl->findElementBySemantic(VES_POSITION))
+            decl->addElement(POS_TEX_BINDING, offset, VET_FLOAT3, VES_POSITION);
+
+        offset += VertexElement::getTypeSize(VET_FLOAT3);
+
+        if (!decl->findElementBySemantic(VES_TEXTURE_COORDINATES))
+            decl->addElement(POS_TEX_BINDING, offset, Ogre::VET_FLOAT2, Ogre::VES_TEXTURE_COORDINATES, 0);
+
+        HardwareVertexBufferSharedPtr ptbuf = HardwareBufferManager::getSingleton().createVertexBuffer(decl->getVertexSize(POS_TEX_BINDING),
+            mRenderOp.vertexData->vertexCount,
+            HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);
+        bind->setBinding(POS_TEX_BINDING, ptbuf);
+
+        // Colours - store these in a separate buffer because they change less often
+        if (!decl->findElementBySemantic(VES_DIFFUSE))
+            decl->addElement(COLOUR_BINDING, 0, VET_COLOUR, VES_DIFFUSE);
+
+        HardwareVertexBufferSharedPtr cbuf = HardwareBufferManager::getSingleton().createVertexBuffer(decl->getVertexSize(COLOUR_BINDING),
+            mRenderOp.vertexData->vertexCount,
+            HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);
+        bind->setBinding(COLOUR_BINDING, cbuf);
+
+        size_t charlen = mCaption.size();
+        Real *pPCBuff = static_cast<Real*>(ptbuf->lock(HardwareBuffer::HBL_DISCARD));
+
+        float largestWidth = 0;
+        float left = 0 * 2.0 - 1.0;
+        float top = -((0 * 2.0) - 1.0);
+
+        // Derive space width from a capital A
+        if (mSpaceWidth == 0)
+            mSpaceWidth = mpFont->getGlyphAspectRatio('A') * mCharHeight * 2.0;
+
+        // for calculation of AABB
+        Ogre::Vector3 min, max, currPos;
+        Ogre::Real maxSquaredRadius;
+        bool first = true;
+
+        // Use iterator
+        String::iterator i, iend;
+        iend = mCaption.end();
+        bool newLine = true;
+        Real len = 0.0f;
+
+        if(mVerticalAlignment == DebugContactText::V_ABOVE)
+        {
+            // Raise the first line of the caption
+            top += mCharHeight;
+            for (i = mCaption.begin(); i != iend; ++i)
+            {
+                if (*i == '\n')
+                    top += mCharHeight * 2.0;
+            }
+        }
+
+        for (i = mCaption.begin(); i != iend; ++i)
+        {
+            if (newLine)
+            {
+                len = 0.0f;
+                for (String::iterator j = i; j != iend && *j != '\n'; j++)
+                {
+                    if (*j == ' ')
+                        len += mSpaceWidth;
+                    else 
+                        len += mpFont->getGlyphAspectRatio(*j) * mCharHeight * 2.0;
+                }
+                newLine = false;
+            }
+
+            if (*i == '\n')
+            {
+                left = 0 * 2.0 - 1.0;
+                top -= mCharHeight * 2.0;
+                newLine = true;
+                continue;
+            }
+
+            if (*i == ' ')
+            {
+                // Just leave a gap, no tris
+                left += mSpaceWidth;
+                // Also reduce tri count
+                mRenderOp.vertexData->vertexCount -= 6;
+                continue;
+            }
+
+            Real horiz_height = mpFont->getGlyphAspectRatio(*i);
+            
+            //mpFont->getGlyphTexCoords(*i, u1, v1, u2, v2);
+            const Font::UVRect &uvRect = mpFont->getGlyphTexCoords(*i);
+            const Real u1 = uvRect.left; 
+            const Real u2 = uvRect.right; 
+            const Real v1 = uvRect.top; 
+            const Real v2 = uvRect.bottom; 
+
+            // each vert is (x, y, z, u, v)
+            //-------------------------------------------------------------------------------------
+            // First tri
+            //
+            // Upper left
+            if(mHorizontalAlignment == DebugContactText::H_LEFT)
+                *pPCBuff++ = left;
+            else
+                *pPCBuff++ = left - (len / 2);
+            *pPCBuff++ = top;
+            *pPCBuff++ = -1.0;
+            *pPCBuff++ = u1;
+            *pPCBuff++ = v1;
+
+            // Deal with bounds
+            if(mHorizontalAlignment == DebugContactText::H_LEFT)
+                currPos = Ogre::Vector3(left, top, -1.0);
+            else
+                currPos = Ogre::Vector3(left - (len / 2), top, -1.0);
+            if (first)
+            {
+                min = max = currPos;
+                maxSquaredRadius = currPos.squaredLength();
+                first = false;
+            }
+            else
+            {
+                min.makeFloor(currPos);
+                max.makeCeil(currPos);
+                maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength());
+            }
+
+            top -= mCharHeight * 2.0;
+
+            // Bottom left
+            if(mHorizontalAlignment == DebugContactText::H_LEFT)
+                *pPCBuff++ = left;
+            else
+                *pPCBuff++ = left - (len / 2);
+            *pPCBuff++ = top;
+            *pPCBuff++ = -1.0;
+            *pPCBuff++ = u1;
+            *pPCBuff++ = v2;
+
+            // Deal with bounds
+            if(mHorizontalAlignment == DebugContactText::H_LEFT)
+                currPos = Ogre::Vector3(left, top, -1.0);
+            else
+                currPos = Ogre::Vector3(left - (len / 2), top, -1.0);
+            min.makeFloor(currPos);
+            max.makeCeil(currPos);
+            maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength());
+
+            top += mCharHeight * 2.0;
+            left += horiz_height * mCharHeight * 2.0;
+
+            // Top right
+            if(mHorizontalAlignment == DebugContactText::H_LEFT)
+                *pPCBuff++ = left;
+            else
+                *pPCBuff++ = left - (len / 2);
+            *pPCBuff++ = top;
+            *pPCBuff++ = -1.0;
+            *pPCBuff++ = u2;
+            *pPCBuff++ = v1;
+            //-------------------------------------------------------------------------------------
+
+            // Deal with bounds
+            if(mHorizontalAlignment == DebugContactText::H_LEFT)
+                currPos = Ogre::Vector3(left, top, -1.0);
+            else
+                currPos = Ogre::Vector3(left - (len / 2), top, -1.0);
+            min.makeFloor(currPos);
+            max.makeCeil(currPos);
+            maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength());
+
+            //-------------------------------------------------------------------------------------
+            // Second tri
+            //
+            // Top right (again)
+            if(mHorizontalAlignment == DebugContactText::H_LEFT)
+                *pPCBuff++ = left;
+            else
+                *pPCBuff++ = left - (len / 2);
+            *pPCBuff++ = top;
+            *pPCBuff++ = -1.0;
+            *pPCBuff++ = u2;
+            *pPCBuff++ = v1;
+
+            currPos = Ogre::Vector3(left, top, -1.0);
+            min.makeFloor(currPos);
+            max.makeCeil(currPos);
+            maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength());
+
+            top -= mCharHeight * 2.0;
+            left -= horiz_height  * mCharHeight * 2.0;
+
+            // Bottom left (again)
+            if(mHorizontalAlignment == DebugContactText::H_LEFT)
+                *pPCBuff++ = left;
+            else
+                *pPCBuff++ = left - (len / 2);
+            *pPCBuff++ = top;
+            *pPCBuff++ = -1.0;
+            *pPCBuff++ = u1;
+            *pPCBuff++ = v2;
+
+            currPos = Ogre::Vector3(left, top, -1.0);
+            min.makeFloor(currPos);
+            max.makeCeil(currPos);
+            maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength());
+
+            left += horiz_height  * mCharHeight * 2.0;
+
+            // Bottom right
+            if(mHorizontalAlignment == DebugContactText::H_LEFT)
+                *pPCBuff++ = left;
+            else
+                *pPCBuff++ = left - (len / 2);
+            *pPCBuff++ = top;
+            *pPCBuff++ = -1.0;
+            *pPCBuff++ = u2;
+            *pPCBuff++ = v2;
+            //-------------------------------------------------------------------------------------
+
+            currPos = Ogre::Vector3(left, top, -1.0);
+            min.makeFloor(currPos);
+            max.makeCeil(currPos);
+            maxSquaredRadius = std::max(maxSquaredRadius, currPos.squaredLength());
+
+            // Go back up with top
+            top += mCharHeight * 2.0;
+
+            float currentWidth = (left + 1)/2 - 0;
+            if (currentWidth > largestWidth)
+                largestWidth = currentWidth;
+        }
+
+        // Unlock vertex buffer
+        ptbuf->unlock();
+
+        // update AABB/Sphere radius
+        mAABB = Ogre::AxisAlignedBox(min, max);
+        mRadius = Ogre::Math::Sqrt(maxSquaredRadius);
+
+        if (mUpdateColors)
+            this->_updateColors();
+
+        mNeedUpdate = false;
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::_updateColors(void)
+    {
+        assert(mpFont);
+        assert(!mpMaterial.isNull());
+
+        // Convert to system-specific
+        RGBA color;
+        Root::getSingleton().convertColourValue(mColor, &color);
+        HardwareVertexBufferSharedPtr vbuf = mRenderOp.vertexData->vertexBufferBinding->getBuffer(COLOUR_BINDING);
+        RGBA *pDest = static_cast<RGBA*>(vbuf->lock(HardwareBuffer::HBL_DISCARD));
+        for (unsigned int i = 0; i < mRenderOp.vertexData->vertexCount; ++i)
+            *pDest++ = color;
+        vbuf->unlock();
+        mUpdateColors = false;
+    }
+    //------------------------------------------------------------------------------------------------
+    const Quaternion& DebugContactText::getWorldOrientation(void) const
+    {
+        assert(mpCam);
+        return const_cast<Quaternion&>(mpCam->getDerivedOrientation());
+    }
+    //------------------------------------------------------------------------------------------------
+    const Vector3& DebugContactText::getWorldPosition(void) const
+    {
+        assert(mParentNode);
+        return mParentNode->_getDerivedPosition();
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::getWorldTransforms(Matrix4 *xform) const 
+    {
+        if (this->isVisible() && mpCam)
+        {
+            Matrix3 rot3x3, scale3x3 = Matrix3::IDENTITY;
+
+            // store rotation in a matrix
+            mpCam->getDerivedOrientation().ToRotationMatrix(rot3x3);
+
+            // parent node position
+            Vector3 ppos = mParentNode->_getDerivedPosition() + Vector3::UNIT_Y*mAdditionalHeight;
+
+            // apply scale
+            scale3x3[0][0] = mParentNode->_getDerivedScale().x / 2;
+            scale3x3[1][1] = mParentNode->_getDerivedScale().y / 2;
+            scale3x3[2][2] = mParentNode->_getDerivedScale().z / 2;
+
+            // apply all transforms to xform       
+            *xform = (rot3x3 * scale3x3);
+            xform->setTrans(ppos);
+        }
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::getRenderOperation(RenderOperation &op)
+    {
+        if (this->isVisible())
+        {
+            if (mNeedUpdate)
+                this->_setupGeometry();
+            if (mUpdateColors)
+                this->_updateColors();
+            op = mRenderOp;
+        }
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::_notifyCurrentCamera(Camera *cam)
+    {
+        mpCam = cam;
+    }
+    //------------------------------------------------------------------------------------------------
+    void DebugContactText::_updateRenderQueue(RenderQueue* queue)
+    {
+        if (this->isVisible())
+        {
+            if (mNeedUpdate)
+                this->_setupGeometry();
+            if (mUpdateColors)
+                this->_updateColors();
+
+            queue->addRenderable(this, mRenderQueueID, OGRE_RENDERABLE_DEFAULT_PRIORITY);
+            //      queue->addRenderable(this, mRenderQueueID, RENDER_QUEUE_SKIES_LATE);
+        }
+    }
+}
Index: /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugContact.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugContact.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugContact.h	(revision 1971)
@@ -0,0 +1,177 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+    (Object-oriented Graphics Rendering Engine Bullet Wrapper)
+	For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+	Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __OgreBulletCollisionsDebugContact_H__
+#define __OgreBulletCollisionsDebugContact_H__
+
+#include "OgreBulletCollisionsPreRequisites.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+
+namespace OgreBulletCollisions 
+{
+    //------------------------------------------------------------------------------------------------
+    class DebugContact
+    {
+    public:
+        DebugContact(const Ogre::String &name, CollisionsWorld *world);
+         ~DebugContact();
+
+         bool isEnabled () const;
+         void setEnabled (bool enable);
+
+         void update(const Ogre::Vector3 &normal, const Ogre::Vector3 &pt, const Ogre::Real depth);
+
+    private:
+        DebugNormal         *_normal;
+        DebugContactText    *_text;
+        Ogre::Entity        *_point;
+        bool                _enabled;
+        Ogre::String        _name;
+        Ogre::SceneNode     *_node;
+        Ogre::SceneNode     *_point_node;
+        CollisionsWorld               *_world;
+    };
+
+    //------------------------------------------------------------------------------------------------
+    class DebugNormal : public DebugLines
+    {
+    public:
+        DebugNormal() : DebugLines(){};
+        ~DebugNormal(){};
+
+        void update (const Ogre::Vector3 &normal, const Ogre::Vector3 &pt, const Ogre::Real depth);
+    };
+
+    //------------------------------------------------------------------------------------------------
+    class DebugContactText : public Ogre::MovableObject, public Ogre::Renderable
+    {
+    public:
+        enum HorizontalAlignment    {H_LEFT, H_CENTER};
+        enum VerticalAlignment      {V_BELOW, V_ABOVE};
+        /******************************** public methods ******************************/
+    public:
+        DebugContactText(const Ogre::String &name, 
+                         Ogre::SceneNode *node,
+                         const Ogre::String &caption = "", 
+                         const Ogre::String &fontName = "BlueHighway", 
+                         int charHeight = 32, 
+                         const Ogre::ColourValue &color = Ogre::ColourValue::White);
+
+
+         ~DebugContactText();
+
+#if (OGRE_VERSION >=  ((1 << 16) | (5 << 8) | 0)) // must have at least shoggoth (1.5.0)
+		void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables);
+#endif
+        // Set settings
+        void    setPosition(const Ogre::Vector3 &pos);
+
+        void    setFontName(const Ogre::String &fontName);
+        void    setCaption(const Ogre::String &caption);
+        void    setColor(const Ogre::ColourValue &color);
+        void    setCharacterHeight(unsigned int height);
+        void    setSpaceWidth(unsigned int width);
+        void    setTextAlignment(const HorizontalAlignment& horizontalAlignment, 
+                                const VerticalAlignment& verticalAlignment);
+        void    setAdditionalHeight( Ogre::Real height );
+        void    showOnTop(bool show=true);
+
+        // Get settings
+        const   Ogre::String          &getFontName() const {return mFontName;}
+        const   Ogre::String          &getCaption() const {return mCaption;}
+        const   Ogre::ColourValue     &getColor() const {return mColor;}
+
+        unsigned int    getCharacterHeight() const {return mCharHeight;}
+        unsigned int    getSpaceWidth() const {return mSpaceWidth;}
+        Ogre::Real                  getAdditionalHeight() const {return mAdditionalHeight;}
+        bool                    getShowOnTop() const {return mOnTop;}
+        Ogre::AxisAlignedBox	        GetAABB(void) { return mAABB; }
+
+        /******************************** protected methods and overload **************/
+    protected:
+
+        // from OgreBulletCollisionsDebugContact, create the object
+        void	_setupGeometry();
+        void	_updateColors();
+
+        // from MovableObject
+        void                            getWorldTransforms(Ogre::Matrix4 *xform) const;
+        Ogre::Real                      getBoundingRadius(void) const {return mRadius;};
+        Ogre::Real                      getSquaredViewDepth(const Ogre::Camera *cam) const {return 0;};
+        const   Ogre::Quaternion        &getWorldOrientation(void) const;
+        const   Ogre::Vector3           &getWorldPosition(void) const;
+        const   Ogre::AxisAlignedBox    &getBoundingBox(void) const {return mAABB;};
+        const   Ogre::String            &getName(void) const {return mName;};
+        const   Ogre::String            &getMovableType(void) const {static Ogre::String movType = "MovableText"; return movType;};
+
+        void                            _notifyCurrentCamera(Ogre::Camera *cam);
+        void                            _updateRenderQueue(Ogre::RenderQueue* queue);
+
+        // from renderable
+        void                            getRenderOperation(Ogre::RenderOperation &op);
+        const   Ogre::MaterialPtr       &getMaterial(void) const {assert(!mpMaterial.isNull());return mpMaterial;};
+        const   Ogre::LightList         &getLights(void) const {return mLList;};
+
+        /******************************** OgreBulletCollisionsDebugContact data ****************************/
+  
+
+    protected:
+        Ogre::String			mFontName;
+        Ogre::String			mType;
+        Ogre::String			mName;
+        Ogre::String			mCaption;
+        HorizontalAlignment	    mHorizontalAlignment;
+        VerticalAlignment	    mVerticalAlignment;
+
+        Ogre::ColourValue		mColor;
+        Ogre::RenderOperation	mRenderOp;
+        Ogre::AxisAlignedBox	mAABB;
+        Ogre::LightList		    mLList;
+
+        unsigned int			mCharHeight;
+        unsigned int			mSpaceWidth;
+
+        bool			        mNeedUpdate;
+        bool			        mUpdateColors;
+        bool			        mOnTop;
+
+        Ogre::Real			    mTimeUntilNextToggle;
+        Ogre::Real			    mRadius;
+        Ogre::Real              mAdditionalHeight;
+
+        Ogre::Camera			*mpCam;
+        Ogre::RenderWindow	    *mpWin;
+        Ogre::Font			    *mpFont;
+        Ogre::MaterialPtr		mpMaterial;
+        Ogre::MaterialPtr		mpBackgroundMaterial;
+
+        Ogre::SceneNode         *mNode;
+    };
+}
+
+#endif //__OgreBulletCollisionsDebugContact_H__
+
Index: /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugDrawer.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugDrawer.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugDrawer.cpp	(revision 1971)
@@ -0,0 +1,241 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Debug/OgreBulletCollisionsDebugDrawer.h"
+#include "Utils/OgreBulletConverter.h"
+
+using namespace OgreBulletCollisions;
+using namespace Ogre;
+
+//------------------------------------------------------------------------------------------------
+DebugDrawer::DebugDrawer() :
+    DebugLines(),
+    btIDebugDraw(),
+    mDebugMode(0)
+{
+}
+//------------------------------------------------------------------------------------------------
+DebugDrawer::~DebugDrawer() 
+{
+}
+//------------------------------------------------------------------------------------------------
+void	DebugDrawer::reportErrorWarning(const char* warningString)
+{
+	Ogre::LogManager::getSingleton().getDefaultLog()->logMessage(warningString);
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setDrawAabb(bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_DrawAabb;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_DrawAabb;
+}
+//------------------------------------------------------------------------------------------------
+void	DebugDrawer::draw3dText(const btVector3& location,const char* textString)
+{
+}
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesDrawAabb () const {return (mDebugMode & btIDebugDraw::DBG_DrawAabb) != 0;};
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesDrawWireframe () const {return (mDebugMode & btIDebugDraw::DBG_DrawWireframe) != 0;};
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesDrawFeaturesText () const {return (mDebugMode & btIDebugDraw::DBG_DrawFeaturesText) != 0;};
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesDrawContactPoints () const {return (mDebugMode & btIDebugDraw::DBG_DrawContactPoints) != 0;};
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesNoDeactivation () const {return (mDebugMode & btIDebugDraw::DBG_NoDeactivation) != 0;};
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesNoHelpText () const {return (mDebugMode & btIDebugDraw::DBG_NoHelpText) != 0;};
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesDrawText () const {return (mDebugMode & btIDebugDraw::DBG_DrawText) != 0;};
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesProfileTimings () const {return (mDebugMode & btIDebugDraw::DBG_ProfileTimings) != 0;};
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesEnableSatComparison () const {return (mDebugMode & btIDebugDraw::DBG_EnableSatComparison) != 0;};
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesDisableBulletLCP () const {return (mDebugMode & btIDebugDraw::DBG_DisableBulletLCP) != 0;};
+//------------------------------------------------------------------------------------------------
+bool DebugDrawer::doesEnableCCD () const {return (mDebugMode & btIDebugDraw::DBG_EnableCCD) != 0;};
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setDrawWireframe(bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_DrawWireframe;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_DrawWireframe;
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setDrawFeaturesText(bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_DrawFeaturesText;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_DrawFeaturesText;
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setDrawContactPoints(bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_DrawContactPoints;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_DrawContactPoints;
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setNoDeactivation(bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_NoDeactivation;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_NoDeactivation;
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setNoHelpText(bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_NoHelpText;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_NoHelpText;
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setDrawText(bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_DrawText;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_DrawText;
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setProfileTimings(bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_ProfileTimings;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_ProfileTimings;
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setEnableSatComparison(bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_EnableSatComparison;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_EnableSatComparison;
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setDisableBulletLCP (bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_DisableBulletLCP ;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_DisableBulletLCP ;
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::setEnableCCD(bool enable)
+{ 
+    if (enable) 
+        mDebugMode |= btIDebugDraw::DBG_EnableCCD;
+    else
+        mDebugMode &= ~btIDebugDraw::DBG_EnableCCD;
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::drawAabb(const btVector3& from,const btVector3& to,const btVector3& color)
+{
+    if (mDebugMode & btIDebugDraw::DBG_DrawAabb)
+    {
+        drawAabb (BtOgreConverter::to(from), BtOgreConverter::to(to), BtOgreConverter::to (color));
+    }
+}
+//------------------------------------------------------------------------------------------------
+void	DebugDrawer::drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
+{
+    if (mDebugMode > 0)
+    {
+        drawLine (BtOgreConverter::to(from), BtOgreConverter::to(to), BtOgreConverter::to (color));
+    }
+}
+//------------------------------------------------------------------------------------------------
+void	DebugDrawer::drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,
+                                              btScalar distance,int lifeTime,const btVector3& color)
+{
+    if (mDebugMode & btIDebugDraw::DBG_DrawContactPoints)
+    {
+        //
+    }
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::drawAabb (const Ogre::Vector3& from,const Ogre::Vector3& to,const Ogre::Vector3& color)
+{
+    if (mDebugMode & btIDebugDraw::DBG_DrawAabb)
+    {
+        Vector3 halfExtents = (to-from)* 0.5f;
+        Vector3 center = (to+from) *0.5f;
+        int i,j;
+
+        Vector3 edgecoord(1.f,1.f,1.f),pa,pb;
+        for (i=0;i<4;i++)
+        {
+            for (j=0;j<3;j++)
+            {
+                pa = Vector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1],		
+                    edgecoord[2]*halfExtents[2]);
+                pa+=center;
+
+                int othercoord = j%3;
+                edgecoord[othercoord]*=-1.f;
+                pb = Vector3(edgecoord[0]*halfExtents[0], edgecoord[1]*halfExtents[1],	
+                    edgecoord[2]*halfExtents[2]);
+                pb+=center;
+
+                drawLine(pa,pb,color);
+            }
+            edgecoord = Vector3(-1.f,-1.f,-1.f);
+            if (i<3)
+                edgecoord[i]*=-1.f;
+        }
+    }
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::drawLine(const Ogre::Vector3& from,const Ogre::Vector3& to,const Ogre::Vector3& color)
+{
+    if (mDebugMode > 0)
+    {
+        addLine (from, to);
+    }
+}
+//------------------------------------------------------------------------------------------------
+void DebugDrawer::drawContactPoint(const Ogre::Vector3& PointOnB,const Ogre::Vector3& normalOnB,
+                                   Real distance,int lifeTime,const Ogre::Vector3& color)
+{
+    if (mDebugMode & btIDebugDraw::DBG_DrawContactPoints)
+    {
+
+    }
+    //...
+}
+//------------------------------------------------------------------------------------------------
+
Index: /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugDrawer.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugDrawer.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugDrawer.h	(revision 1971)
@@ -0,0 +1,91 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+#ifndef _OgreBulletCollisions_DebugDrawer_H_
+#define _OgreBulletCollisions_DebugDrawer_H_
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+namespace OgreBulletCollisions
+{
+	//------------------------------------------------------------------------------------------------
+	class  DebugDrawer : public DebugLines, public btIDebugDraw
+	{
+	public:
+        DebugDrawer();
+		virtual ~DebugDrawer();
+
+
+        virtual void	setDebugMode(int mode){mDebugMode = mode;};
+        virtual int		getDebugMode() const { return mDebugMode;};
+
+        virtual void	drawLine(const btVector3& from,const btVector3& to,const btVector3& color);
+        virtual void	drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,
+            btScalar distance,int lifeTime,const btVector3& color);
+
+        void drawAabb(const Ogre::Vector3& from,const Ogre::Vector3& to,const Ogre::Vector3& color);
+        void drawLine(const Ogre::Vector3& from,const Ogre::Vector3& to,const Ogre::Vector3& color);
+        void drawContactPoint(const Ogre::Vector3& PointOnB,const Ogre::Vector3& normalOnB,
+            Ogre::Real distance,int lifeTime,const Ogre::Vector3& color);
+
+        void setDrawAabb(bool enable);
+        void setDrawWireframe(bool enable);
+        void setDrawFeaturesText(bool enable);
+        void setDrawContactPoints(bool enable);
+        void setNoDeactivation(bool enable);
+        void setNoHelpText(bool enable);
+        void setDrawText(bool enable);
+        void setProfileTimings(bool enable);
+        void setEnableSatComparison(bool enable);
+        void setDisableBulletLCP (bool enable);
+        void setEnableCCD(bool enable);
+
+        bool doesDrawAabb () const;
+        bool doesDrawWireframe () const;
+        bool doesDrawFeaturesText () const;
+        bool doesDrawContactPoints () const;
+        bool doesNoDeactivation () const;
+        bool doesNoHelpText () const;
+        bool doesDrawText () const;
+        bool doesProfileTimings () const;
+        bool doesEnableSatComparison () const;
+        bool doesDisableBulletLCP () const;
+        bool doesEnableCCD () const;
+
+        void drawAabb(const btVector3& from,const btVector3& to,const btVector3& color);
+
+		// TODO
+		void	draw3dText(const btVector3& location,const char* textString);
+
+		void	reportErrorWarning(const char* warningString);
+	protected:
+        int mDebugMode;
+	};
+}
+
+#endif //_OgreBulletCollisions_DebugDrawer_H_
+
Index: /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugLines.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugLines.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugLines.cpp	(revision 1971)
@@ -0,0 +1,162 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+#include "Utils/OgreBulletConverter.h"
+
+using namespace OgreBulletCollisions;
+using namespace Ogre;
+
+//------------------------------------------------------------------------------------------------
+bool DebugLines::_materials_created = false;
+//------------------------------------------------------------------------------------------------
+DebugLines::DebugLines() : SimpleRenderable()
+{
+    mRenderOp.vertexData = new Ogre::VertexData();
+    _drawn = false;
+
+    if (!_materials_created)
+    {
+        MaterialPtr red = MaterialManager::getSingleton().create("OgreBulletCollisionsDebugLines/Disabled","OgreBulletCollisions");
+        MaterialPtr green = MaterialManager::getSingleton().create("OgreBulletCollisionsDebugLines/Enabled","OgreBulletCollisions");
+        MaterialPtr blue = MaterialManager::getSingleton().create("OgreBulletCollisionsDebugLines/Static","OgreBulletCollisions");
+
+        red->setReceiveShadows(false);
+        red->getTechnique(0)->setLightingEnabled(true);
+        red->getTechnique(0)->getPass(0)->setSelfIllumination(1,0,0);
+
+        green->setReceiveShadows(false);
+        green->getTechnique(0)->setLightingEnabled(true);
+        green->getTechnique(0)->getPass(0)->setSelfIllumination(0,1,0);
+
+        blue->setReceiveShadows(false);
+        blue->getTechnique(0)->setLightingEnabled(true);
+        blue->getTechnique(0)->getPass(0)->setSelfIllumination(0,0,1);
+
+        _materials_created = true;
+    }
+    setCastShadows (false);
+    this->setMaterial("OgreBulletCollisionsDebugLines/Enabled");
+}
+
+
+//------------------------------------------------------------------------------------------------
+void DebugLines::clear()
+{
+    if (_drawn)
+    {
+        _drawn = false;
+        _points.clear();
+        delete mRenderOp.vertexData;
+
+        mRenderOp.vertexData = new Ogre::VertexData();
+    }
+}
+//------------------------------------------------------------------------------------------------
+DebugLines::~DebugLines(void)
+{
+    clear();
+
+    delete mRenderOp.vertexData;
+}
+//------------------------------------------------------------------------------------------------
+void DebugLines::draw()
+{
+    if (_drawn || _points.empty()) 
+        return;
+    else 
+        _drawn = true;
+
+    // Initialization stuff
+    mRenderOp.indexData = 0;
+    mRenderOp.vertexData->vertexCount = _points.size();
+    mRenderOp.vertexData->vertexStart = 0;
+    mRenderOp.operationType = RenderOperation::OT_LINE_LIST;
+    mRenderOp.useIndexes = false;
+
+    Ogre::VertexDeclaration *decl = mRenderOp.vertexData->vertexDeclaration;
+    Ogre::VertexBufferBinding *bind = mRenderOp.vertexData->vertexBufferBinding;
+
+    decl->addElement(0, 0, VET_FLOAT3, VES_POSITION);
+
+    HardwareVertexBufferSharedPtr vbuf =
+        HardwareBufferManager::getSingleton().createVertexBuffer(
+        decl->getVertexSize(0),
+        mRenderOp.vertexData->vertexCount,
+        HardwareBuffer::HBU_STATIC_WRITE_ONLY);
+
+    bind->setBinding(0, vbuf);
+
+    // Drawing stuff
+    unsigned int size = (unsigned int)_points.size();
+    Ogre::Vector3 vaabMin = _points[0];
+    Ogre::Vector3 vaabMax = _points[0];
+
+    float *prPos = static_cast<float*>(vbuf->lock(HardwareBuffer::HBL_DISCARD));
+
+    for(unsigned int i = 0; i < size; i++)
+    {
+        *prPos++ = _points[i].x;
+        *prPos++ = _points[i].y;
+        *prPos++ = _points[i].z;
+
+        if (_points[i].x < vaabMin.x)
+            vaabMin.x = _points[i].x;
+        if (_points[i].y < vaabMin.y)
+            vaabMin.y = _points[i].y;
+        if (_points[i].z < vaabMin.z)
+            vaabMin.z = _points[i].z;
+
+        if (_points[i].x > vaabMax.x)
+            vaabMax.x = _points[i].x;
+        if (_points[i].y > vaabMax.y)
+            vaabMax.y = _points[i].y;
+        if (_points[i].z > vaabMax.z)
+            vaabMax.z = _points[i].z;
+    }
+
+    vbuf->unlock();
+
+    mBox.setExtents(vaabMin, vaabMax);
+}
+//------------------------------------------------------------------------------------------------
+Real DebugLines::getSquaredViewDepth(const Camera *cam) const
+{
+    Vector3 vMin, vMax, vMid, vDist;
+    vMin = mBox.getMinimum();
+    vMax = mBox.getMaximum();
+    vMid = ((vMin - vMax) * 0.5) + vMin;
+    vDist = cam->getDerivedPosition() - vMid;
+
+    return vDist.squaredLength();
+}
+//------------------------------------------------------------------------------------------------
+Real DebugLines::getBoundingRadius() const
+{
+    return Math::Sqrt(std::max(mBox.getMaximum().squaredLength(), mBox.getMinimum().squaredLength()));
+}
Index: /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugLines.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugLines.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugLines.h	(revision 1971)
@@ -0,0 +1,82 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+#ifndef _OgreBulletCollisions_DEBUGLines_H_
+#define _OgreBulletCollisions_DEBUGLines_H_
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+namespace OgreBulletCollisions
+{
+    //------------------------------------------------------------------------------------------------
+    class  DebugLines:public Ogre::SimpleRenderable
+    {
+    public:
+        DebugLines(void);
+        ~DebugLines(void);
+
+        void addLine (const Ogre::Vector3 &start,const Ogre::Vector3 &end)
+        {
+            clear ();
+
+            _points.push_back (start);
+            _points.push_back (end);
+        }
+
+        void addLine(Ogre::Real start_x, Ogre::Real start_y, Ogre::Real start_z, 
+            Ogre::Real end_x, Ogre::Real end_y, Ogre::Real end_z)
+        {
+            addLine (Ogre::Vector3(start_x,start_y,start_z),
+                Ogre::Vector3(end_x,end_y,end_z));
+        }
+
+        void addPoint (const Ogre::Vector3 &pt)
+        {
+            clear();
+
+            _points.push_back(pt);
+        }
+
+        void addPoint (Ogre::Real x, Ogre::Real y, Ogre::Real z)
+        {
+            addPoint (Ogre::Vector3(x, y, z));
+        }
+
+        void draw ();
+        void clear ();
+
+        Ogre::Real getSquaredViewDepth (const Ogre::Camera *cam) const;
+        Ogre::Real getBoundingRadius (void) const;
+
+    protected:
+
+        Vector3Array _points;
+        bool _drawn;
+
+        static bool _materials_created;
+    };
+}
+#endif //_OgreBulletCollisions_DEBUGLines_H_
+
Index: /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugShape.cpp	(revision 1971)
@@ -0,0 +1,110 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "OgreBulletCollisionsShape.h"
+#include "Debug/OgreBulletCollisionsDebugShape.h"
+#include "Utils/OgreBulletConverter.h"
+
+using namespace OgreBulletCollisions;
+using namespace Ogre;
+
+//------------------------------------------------------------------------------------------------
+DebugCollisionShape::DebugCollisionShape(CollisionShape *shape, DebugCollisionShape::Mode mode) 
+{
+    setStatemode(mode);
+    // try to draw debug wire frame of the shape
+    mIsVisual = shape->drawWireFrame (this);
+
+    // if no success (not possible or not implemented
+    // does not draw, hence saving a segfault
+    if (mIsVisual)
+        DebugLines::draw ();
+}
+//------------------------------------------------------------------------------------------------
+void DebugCollisionShape::setStatemode(DebugCollisionShape::Mode mode)
+{
+	if (mode != mStatemode)
+	{
+		mStatemode = mode;
+		switch(mStatemode)
+		{
+			case DebugCollisionShape::Mode_Enabled:
+				setMaterial("OgreBulletCollisionsDebugLines/Enabled");
+			break;
+
+			case DebugCollisionShape::Mode_Disabled:
+				setMaterial("OgreBulletCollisionsDebugLines/Disabled");
+
+			break;
+
+			case DebugCollisionShape::Mode_Static:
+				setMaterial("OgreBulletCollisionsDebugLines/Static");
+			break;
+		}
+	}
+}
+//------------------------------------------------------------------------------------------------
+DebugCollisionShape::~DebugCollisionShape() 
+{
+}
+//------------------------------------------------------------------------------------------------
+bool DebugCollisionShape::getIsVisual() const
+{
+    return mIsVisual;
+}
+//------------------------------------------------------------------------------------------------
+void DebugCollisionShape::setIsVisual( bool val )
+{
+    mIsVisual = val;
+}
+//------------------------------------------------------------------------------------------------
+RayDebugShape::RayDebugShape(const Ogre::Vector3& start, 
+							   const Ogre::Vector3& direction, 
+							   const Ogre::Real length)
+{
+	const Ogre::Vector3 end (start + (direction.normalisedCopy() * length));
+	addLine(start, end);
+
+	draw();
+}
+//------------------------------------------------------------------------------------------------
+void RayDebugShape::setDefinition(const Ogre::Vector3& start,
+							const Ogre::Vector3& direction, 
+							const Ogre::Real length)
+{
+	clear();
+
+	const Ogre::Vector3 end (start + (direction.normalisedCopy() * length));
+	addLine(start, end);
+
+	draw();
+}
+//------------------------------------------------------------------------------------------------
+RayDebugShape::~RayDebugShape()
+{
+}
Index: /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Debug/OgreBulletCollisionsDebugShape.h	(revision 1971)
@@ -0,0 +1,84 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+#ifndef _OgreBulletCollisions_DEBUGOBJECT_H_
+#define _OgreBulletCollisions_DEBUGOBJECT_H_
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+namespace OgreBulletCollisions
+{
+   
+	//------------------------------------------------------------------------------------------------
+	class  DebugCollisionShape : public DebugLines
+	{
+	public:
+		enum Mode
+		{
+			Mode_Unknown,
+			Mode_Enabled,
+			Mode_Disabled,
+			Mode_Static
+        };
+
+	public:
+        /** DebugCollisionShape ctor
+        */
+        DebugCollisionShape(CollisionShape * shape, 
+                            DebugCollisionShape::Mode mode = DebugCollisionShape::Mode_Enabled);
+		/** ~DebugCollisionShape ctor
+		*/
+        virtual ~DebugCollisionShape();
+        // mStatemode getter
+        DebugCollisionShape::Mode getStatemode() const { return mStatemode; }
+        // mStatemode setter
+        void setStatemode(DebugCollisionShape::Mode val);
+        // mIsVisual getter
+        bool getIsVisual() const;
+        // mIsVisual setter
+        void setIsVisual(bool val);
+
+	protected:
+        DebugCollisionShape::Mode mStatemode;
+        bool                      mIsVisual;
+
+
+	};
+	//------------------------------------------------------------------------------------------------
+	class  RayDebugShape:public DebugLines
+	{
+	public:
+		RayDebugShape(const Ogre::Vector3& start,const Ogre::Vector3& direction,const Ogre::Real length);
+		void setDefinition(const Ogre::Vector3& start,const Ogre::Vector3& direction,const Ogre::Real length);
+		virtual ~RayDebugShape();
+    };
+    //------------------------------------------------------------------------------------------------
+}
+
+#endif //_OgreBulletCollisions_DEBUGOBJECT_H_
+
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisions.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisions.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisions.h	(revision 1971)
@@ -0,0 +1,94 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_H
+#define _OGREBULLETCOLLISIONS_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+
+#ifdef _PRECOMP
+
+
+    #include "Utils/OgreBulletConverter.h"
+
+	//Debug Helpers
+	#include "Debug/OgreBulletCollisionsDebugLines.h"
+	#include "Debug/OgreBulletCollisionsDebugShape.h"
+	#include "Debug/OgreBulletCollisionsDebugDrawer.h"
+	#include "Debug/OgreBulletCollisionsDebugContact.h"
+
+    //Shapes
+    #include "OgreBulletCollisionsShape.h"
+
+    #include "Shapes/OgreBulletCollisionsBoxShape.h"
+    #include "Shapes/OgreBulletCollisionsConeShape.h"
+    #include "Shapes/OgreBulletCollisionsSphereShape.h"
+    #include "Shapes/OgreBulletCollisionsCylinderShape.h"
+	#include "Shapes/OgreBulletCollisionsTriangleShape.h"
+	#include "Shapes/OgreBulletCollisionsTerrainShape.h"
+	#include "Shapes/OgreBulletCollisionsCylinderShape.h"
+	#include "Shapes/OgreBulletCollisionsCapsuleShape.h"
+    #include "Shapes/OgreBulletCollisionsStaticPlaneShape.h"
+
+    #include "Shapes/OgreBulletCollisionsCompoundShape.h"
+
+    #include "Shapes/OgreBulletCollisionsMultiSphereShape.h"
+
+    #include "Shapes/OgreBulletCollisionsConvexHullShape.h"
+    #include "Shapes/OgreBulletCollisionsMinkowskiSumShape.h"
+
+    #include "Shapes/OgreBulletCollisionsTrimeshShape.h"
+
+    //Utils
+    #include "Utils/OgreBulletCollisionsMeshToShapeConverter.h"
+
+    // Ray
+    //#include "OgreBulletCollisionsConvexCast.h"
+
+    // Core Collisions
+    #include "OgreBulletCollisionsObject.h"
+    #include "OgreBulletCollisionsObjectState.h"
+
+    #include "OgreBulletCollisionsWorld.h"
+
+    #include "OgreBulletCollisionsRay.h"
+
+
+
+
+
+    #include "OgreString.h"
+    #include "OgreFontManager.h"
+
+    #include "BulletCollision/CollisionShapes/btMinkowskiSumShape.h"
+    #include "BulletCollision/CollisionShapes/btTriangleShape.h"
+
+
+#endif //_PRECOMP
+
+#endif //_OGREBULLETCOLLISIONS_H
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObject.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObject.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObject.cpp	(revision 1971)
@@ -0,0 +1,197 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "OgreBulletCollisionsObject.h"
+#include "Debug/OgreBulletCollisionsDebugShape.h"
+
+#include "OgreBulletCollisionsObjectState.h"
+#include "OgreBulletCollisionsShape.h"
+#include "OgreBulletCollisionsWorld.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    //-----------------------------------------------------------------------
+    const Ogre::String Object::mMovableType = "OgreBullet::Object";
+    // -------------------------------------------------------------------------
+    Object::Object(const String &name, CollisionsWorld *world, bool init)
+        :	
+        MovableObject(name),
+        UserDefinedObject(),
+        mWorld(world),
+        mShape(0),
+        mState(0),
+        mRootNode(0),
+        mBounds(Vector3::ZERO, Vector3::ZERO),
+        mDebugShape(0),
+        mShapeNode(0),
+        mDebugNode(0)
+    {
+        if (init)
+        {
+            mObject = new btCollisionObject();
+            mState = new ObjectState(this);
+        }
+    }
+    // -------------------------------------------------------------------------
+    Object::~Object()
+    {
+        if (mRootNode)
+        {
+            showDebugShape(false);
+            mShapeNode->detachObject (this);
+            mRootNode->removeAndDestroyChild (mShapeNode->getName ());
+            //mRootNode->getParentSceneNode ()->removeAndDestroyChild (mRootNode->getName ());
+        }
+
+        getBulletCollisionWorld()->removeCollisionObject( mObject );
+		getCollisionWorld()->removeObject(this);
+
+        delete mObject;        
+        delete mShape;
+        delete mState;
+        delete mDebugShape;
+    }
+    //-----------------------------------------------------------------------
+    void Object::showDebugShape(bool show)
+    {
+        if (show && mDebugShape == 0 && mShape)
+        {
+            mDebugShape = new DebugCollisionShape(mShape);
+            if (mDebugShape->getIsVisual ())
+            {
+                assert (mDebugNode == 0);
+                mDebugNode = mRootNode->createChildSceneNode(mName + "DebugShape");
+                mDebugNode->attachObject (mDebugShape);
+            }
+        }
+        else if (mDebugShape)
+        {
+            if (mDebugShape->getIsVisual ())
+            {
+                assert (mDebugNode);
+                mDebugNode->detachObject (mDebugShape->getName());
+                mRootNode->removeAndDestroyChild (mDebugNode->getName());
+                mDebugNode = 0;
+            }
+            assert (mDebugNode == 0);
+            delete mDebugShape;
+            mDebugShape = 0;
+        }
+    }
+    // -------------------------------------------------------------------------
+    void Object::setTransform(const btVector3 &pos, const btQuaternion &quat)
+    { 
+        mRootNode->setPosition(pos[0], pos[1], pos[2]);
+        mRootNode->setOrientation(quat.getW(),quat.getX(), quat.getY(), quat.getZ());
+    }
+    // -------------------------------------------------------------------------
+    void Object::setPosition(const btVector3 &pos)
+    {
+        mRootNode->setPosition(pos[0], pos[1], pos[2]);
+    }
+    // -------------------------------------------------------------------------
+    void Object::setOrientation(const btQuaternion &quat)
+    {   
+        mRootNode->setOrientation(quat.getW(),quat.getX(), quat.getY(), quat.getZ());
+    }
+    // -------------------------------------------------------------------------
+    void Object::setTransform(const btTransform& worldTrans)
+    { 
+        mRootNode->setPosition(worldTrans.getOrigin()[0], worldTrans.getOrigin()[1],worldTrans.getOrigin()[2]);
+        mRootNode->setOrientation(worldTrans.getRotation().getW(),worldTrans.getRotation().getX(), worldTrans.getRotation().getY(), worldTrans.getRotation().getZ());
+    }
+    //-----------------------------------------------------------------------
+    void Object::setShape(CollisionShape *shape, 
+        const Vector3 &pos, 
+        const Quaternion &quat)
+    {
+        mShape = shape;
+
+        mRootNode = mWorld->getSceneManager()->getRootSceneNode()->createChildSceneNode(mName, pos, quat);
+        mShapeNode = mRootNode->createChildSceneNode(mName + "Shape");
+        mShapeNode->attachObject(this);
+
+        mObject->setCollisionShape(shape->getBulletShape());
+        showDebugShape(mWorld->getShowDebugShapes());       
+    }
+    // -------------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    void Object::_notifyAttached(Node* parent, bool isTagPoint)
+    {
+        MovableObject::_notifyAttached(parent,isTagPoint);
+        if (parent)
+        {
+            Object* other_object = mWorld->findObject(static_cast<SceneNode*>(parent));
+            if ((other_object) && (other_object != this))
+            {
+                static_cast<SceneNode*>(parent)->detachObject(other_object);
+
+            }
+            setPosition(parent->getPosition());
+            setOrientation(parent->getOrientation());
+        } 
+    }
+#if (OGRE_VERSION >=  ((1 << 16) | (5 << 8) | 0)) // must have at least shoggoth (1.5.0)
+    //-----------------------------------------------------------------------
+	void Object::visitRenderables(Renderable::Visitor* visitor, 
+		bool debugRenderables)
+	{
+		//visitor->visit(this, 0, false);
+	}
+#endif
+    //-----------------------------------------------------------------------
+    const Ogre::String& Object::getMovableType() const
+    {
+        return mMovableType;
+    }
+
+    //-----------------------------------------------------------------------
+    void Object::_notifyCurrentCamera(Camera* camera)
+    {
+    }
+
+    //-----------------------------------------------------------------------
+    const AxisAlignedBox& Object::getBoundingBox(void) const
+    {
+        return mBounds;
+    }
+    //-----------------------------------------------------------------------
+    Real Object::getBoundingRadius(void) const
+    {
+        return Ogre::Real(0.0);
+    }
+
+    //-----------------------------------------------------------------------
+    void Object::_updateRenderQueue(RenderQueue* queue)
+    {
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObject.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObject.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObject.h	(revision 1971)
@@ -0,0 +1,123 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_CollisionObject_H
+#define _OGREBULLETCOLLISIONS_CollisionObject_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsWorld.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    /*!
+	 * \brief
+	 * 
+	 * Object is the Basic Bullet Collision representation of an Physical thing in
+     * a scene. It does need a Shape Object to know its "Geometrics" Bounds.
+	 * 
+	 * \remarks
+	 * Objects doesn't need to be represented by a Visible 3D mesh.
+	 * 
+	 * \see
+	 * Ogre::MovableObject | Ogre::UserDefinedObject | OgreBulletDynamics::RigidBody
+	 */
+	class Object : public Ogre::MovableObject, public Ogre::UserDefinedObject
+    {
+    public:
+
+
+
+        Object(const Ogre::String &name,  CollisionsWorld *world, bool init);
+
+
+        virtual ~Object();
+
+        // override Movables
+#if (OGRE_VERSION >=  ((1 << 16) | (5 << 8) | 0)) // must have at least shoggoth (1.5.0)
+		void visitRenderables(Ogre::Renderable::Visitor* visitor, bool debugRenderables);
+#endif
+        virtual const Ogre::String& getMovableType() const; 
+        virtual void _notifyAttached(Ogre::Node* parent,bool isTagPoint = false);
+        //virtual const Ogre::String& getName(void) const {return mName};
+        virtual void _notifyCurrentCamera(Ogre::Camera* camera);
+        virtual const Ogre::AxisAlignedBox& getBoundingBox(void) const;
+        virtual Ogre::Real getBoundingRadius(void) const;
+        virtual void _updateRenderQueue(Ogre::RenderQueue* queue);
+
+
+        inline const Ogre::Vector3 &getWorldPosition() const {return mRootNode->_getDerivedPosition();};
+		inline const Ogre::Quaternion &getWorldOrientation() const {return mRootNode->_getDerivedOrientation();};
+
+        inline void setPosition(const Ogre::Vector3 &p) {mRootNode->setPosition (p);};
+        inline void setOrientation(const Ogre::Quaternion &q)  {return mRootNode->setOrientation (q);};
+
+        inline void setPosition(const Ogre::Real x, const Ogre::Real y, const Ogre::Real z) {mRootNode->setPosition (x,y,z);};
+        inline void setOrientation(const Ogre::Real x, const Ogre::Real y, const Ogre::Real z, const Ogre::Real w)  {return mRootNode->setOrientation (x,y,z,w);};
+
+        virtual void setPosition(const btVector3 &pos);
+        virtual void setOrientation(const btQuaternion &quat);
+        virtual void setTransform(const btVector3 &pos, const btQuaternion &quat);
+        virtual void setTransform(const btTransform& worldTrans);
+
+        inline btCollisionObject*  getBulletObject() const { return mObject;};
+        inline btCollisionWorld*  getBulletCollisionWorld() const { return mWorld->getBulletCollisionWorld ();};
+        inline CollisionsWorld*  getCollisionWorld() const { return mWorld;};
+        
+        inline CollisionShape *getShape() const{ return mShape;};
+        inline DebugCollisionShape* getDebugShape() const{ return mDebugShape;};
+
+        void setShape(CollisionShape *shape, 
+            const Ogre::Vector3 &pos, 
+            const Ogre::Quaternion &quat);
+        void showDebugShape(bool show);
+
+		Ogre::SceneNode *getRootNode() { return mRootNode; }
+
+    protected:
+
+        Ogre::SceneNode*        mRootNode;
+        Ogre::SceneNode*        mShapeNode;
+        Ogre::SceneNode*        mDebugNode;
+
+        ObjectState   *         mState;
+        CollisionsWorld*        mWorld;
+
+        btCollisionObject*      mObject;
+
+        Ogre::AxisAlignedBox    mBounds;
+
+        CollisionShape*         mShape;
+        DebugCollisionShape *   mDebugShape;
+
+    public:
+        static const Ogre::String mMovableType;
+    };
+    // -------------------------------------------------------------------------
+}
+#endif //_OGREBULLETCOLLISIONS_CollisionObject_H
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObjectState.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObjectState.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObjectState.cpp	(revision 1971)
@@ -0,0 +1,64 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Utils/OgreBulletConverter.h"
+#include "OgreBulletCollisionsObject.h"
+#include "OgreBulletCollisionsObjectState.h"
+
+using namespace Ogre;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    ObjectState::ObjectState(Object *parent):	
+        mObject(parent)
+    {
+    }
+    // -------------------------------------------------------------------------
+    ObjectState::~ObjectState()
+    {
+    }
+    // -------------------------------------------------------------------------
+    void ObjectState::getWorldTransform(btTransform& worldTrans) const
+    {
+        assert (mObject);
+
+        // could use mWorldTrans ?
+		
+        worldTrans.setOrigin(OgreBtConverter::to(mObject->getWorldPosition()));
+        worldTrans.setRotation(OgreBtConverter::to(mObject->getWorldOrientation()));
+    }
+    // -------------------------------------------------------------------------
+    void ObjectState::setWorldTransform(const btTransform& worldTrans)
+    {
+        assert (mObject);        
+
+        mObject->setTransform (worldTrans);
+        mWorldTrans = worldTrans;        
+    }
+}
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObjectState.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObjectState.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsObjectState.h	(revision 1971)
@@ -0,0 +1,50 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_ObjectState_H
+#define _OGREBULLETCOLLISIONS_ObjectState_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+
+namespace OgreBulletCollisions
+{
+    class ObjectState : public btMotionState
+    {
+    public:
+	    ObjectState(Object *parent);
+	    ~ObjectState();
+    	
+	    virtual void getWorldTransform(btTransform& worldTrans ) const;
+        virtual void setWorldTransform(const btTransform& worldTrans);	
+
+    private:
+        Object      *mObject;
+        btTransform  mWorldTrans;
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_ObjectState_H
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsPreRequisites.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsPreRequisites.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsPreRequisites.h	(revision 1971)
@@ -0,0 +1,95 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_PREREQUISITES_H
+#define _OGREBULLETCOLLISIONS_PREREQUISITES_H
+
+#include "btBulletCollisionCommon.h"
+
+#include "BulletCollision/GIMPACT/btGImpactShape.h"
+#include "BulletCollision/GIMPACT/btGImpactCollisionAlgorithm.h"
+
+#include "Ogre.h"
+
+/* Some <math.h> files do not define M_PI... */
+#ifndef M_PI
+#define M_PI 3.14159265
+#endif
+
+namespace OgreBulletCollisions
+{
+    class BtOgreConverter;
+    class OgreBtConverter;
+
+    class CollisionsWorld;
+
+    class CollisionRayResultCallback;
+    class CollisionClosestRayResultCallback;
+
+    class DebugLines;
+
+    class DebugDrawer;
+
+    class DebugContact;
+    class DebugNormal;
+    class DebugContactText;
+    
+    class DebugCollisionShape;
+    class BoxDebugShape;
+    class SphereDebugShape;
+    class ConeDebugShape;
+    class TriangleMeshDebugShape;
+    class RayDebugShape;
+
+	class GImpactConcaveShape;
+	class HeightmapCollisionShape;
+    class CollisionShape;
+    class BoxCollisionShape;
+    class SphereCollisionShape;
+    class CylinderCollisionShape;
+	class CapsuleCollisionShape;
+    class ConeCollisionShape;
+
+    class CompoundCollisionShape;
+
+    class MultiSphereCollisionShape;
+    class MinkowskiSumCollisionShape;
+
+    class ConvexHullCollisionShape;
+    class TriangleMeshCollisionShape;
+
+    class Object;
+
+    class ObjectState;
+
+    typedef std::vector<Ogre::Vector3> Vector3Array;
+    typedef std::map<unsigned char, Vector3Array* > BoneIndex;
+    typedef std::pair<unsigned short, Vector3Array* > BoneKeyIndex;
+
+}
+
+#endif //_OGREBULLETCOLLISIONS_PREREQUISITES_H
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsPrecompiled.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsPrecompiled.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsPrecompiled.cpp	(revision 1971)
@@ -0,0 +1,27 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsRay.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsRay.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsRay.cpp	(revision 1971)
@@ -0,0 +1,104 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "OgreBulletCollisionsWorld.h"
+#include "OgreBulletCollisionsRay.h"
+#include "Utils/OgreBulletConverter.h"
+
+#include "OgreBulletCollisionsObject.h"
+#include "Debug/OgreBulletCollisionsDebugShape.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+	CollisionRayResultCallback::CollisionRayResultCallback(const Ogre::Ray &ray, 
+							CollisionsWorld *world, Ogre::Real max_distance,
+							bool init):
+        mRayResultCallback(0),
+        mWorld(world),
+        mRay (ray),
+		mMaxDistance(max_distance)
+    {
+        if (init)
+        {
+            //mRay = new btCollisionWorld::RayResultCallback (
+            //    OgreBtConverter::to(ray.getOrigin ()), 
+            //   OgreBtConverter::to(ray.getDirection ()));
+        }
+	}
+    // -------------------------------------------------------------------------
+    CollisionRayResultCallback::~CollisionRayResultCallback()
+    {
+        if (mRayResultCallback)
+        {
+            delete mRayResultCallback;
+            mRayResultCallback = 0;
+        }
+    }
+    Ogre::Vector3 CollisionRayResultCallback::getRayStartPoint() const
+    {
+      return mRay.getOrigin();
+    }
+    // -------------------------------------------------------------------------
+    Ogre::Vector3 CollisionRayResultCallback::getRayEndPoint() const
+    {
+      return mRay.getPoint(mMaxDistance);
+    }
+    // -------------------------------------------------------------------------
+    bool  CollisionRayResultCallback::doesCollide() const
+    {
+        return mRayResultCallback->hasHit();
+    }
+    // -------------------------------------------------------------------------
+    Object  *CollisionClosestRayResultCallback::getCollidedObject () const
+    {        
+        return mWorld->findObject(static_cast<btCollisionWorld::ClosestRayResultCallback *> (mRayResultCallback)->m_collisionObject);
+	}
+    // -------------------------------------------------------------------------
+	CollisionClosestRayResultCallback::CollisionClosestRayResultCallback(const Ogre::Ray &ray, CollisionsWorld *world, Ogre::Real max_distance) :
+        CollisionRayResultCallback(ray, world, max_distance, false)
+    {
+        mRayResultCallback = new btCollisionWorld::ClosestRayResultCallback (
+            OgreBtConverter::to(getRayStartPoint ()), 
+            OgreBtConverter::to(getRayEndPoint ()));
+    } 
+    // -------------------------------------------------------------------------
+    Vector3 CollisionClosestRayResultCallback::getCollisionPoint() const
+    {
+        return BtOgreConverter::to(getBulletClosestRayResultCallback()->m_hitPointWorld);
+	}
+	// -------------------------------------------------------------------------
+	Vector3 CollisionClosestRayResultCallback::getCollisionNormal() const
+	{
+		return BtOgreConverter::to(getBulletClosestRayResultCallback()->m_hitNormalWorld);
+	}
+}
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsRay.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsRay.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsRay.h	(revision 1971)
@@ -0,0 +1,88 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_CollisionRay_H
+#define _OGREBULLETCOLLISIONS_CollisionRay_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic CollisionRay
+    class CollisionRayResultCallback 
+    {
+	public:
+		CollisionRayResultCallback(const Ogre::Ray &ray, CollisionsWorld *world, Ogre::Real max_distance, bool init = true);
+	    virtual ~CollisionRayResultCallback();
+
+        btCollisionWorld::RayResultCallback *getBulletRay() const {return mRayResultCallback;}
+
+		bool doesCollide () const;
+
+		void setRay(const Ogre::Ray &ray);
+		void setWorld(CollisionsWorld *world);
+		void setMaxDistance(Ogre::Real max_distance);
+
+        inline const Ogre::Ray &getRay() const;
+		inline Ogre::Vector3 getRayStartPoint() const;
+		inline Ogre::Vector3 getRayEndPoint() const;
+
+    protected:
+
+        btCollisionWorld::RayResultCallback   *mRayResultCallback;
+        CollisionsWorld                       *mWorld;
+        Ogre::Ray                              mRay;
+		Ogre::Real                             mMaxDistance;
+
+    };
+    // -------------------------------------------------------------------------
+    // basic CollisionRay inline methods
+    inline const Ogre::Ray &CollisionRayResultCallback ::getRay() const 
+    {
+        return mRay;
+    }
+    // -------------------------------------------------------------------------
+    //  CollisionClosestRay
+    class CollisionClosestRayResultCallback : public CollisionRayResultCallback
+    { 
+	public:
+		CollisionClosestRayResultCallback(const Ogre::Ray &ray, CollisionsWorld *world, Ogre::Real max_distance);
+        virtual ~CollisionClosestRayResultCallback(){};
+
+        Object *getCollidedObject() const;
+		Ogre::Vector3 getCollisionPoint() const;
+		Ogre::Vector3 getCollisionNormal() const;
+
+        inline btCollisionWorld::ClosestRayResultCallback *getBulletClosestRayResultCallback() const 
+        {
+            return static_cast <btCollisionWorld::ClosestRayResultCallback * > (mRayResultCallback);
+        }
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_CollisionRay_H
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsShape.cpp	(revision 1971)
@@ -0,0 +1,172 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "OgreBulletCollisionsShape.h"
+#include "Utils/OgreBulletConverter.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    CollisionShape::CollisionShape()
+        :	
+        mShape(0)
+    {
+    }
+    // -------------------------------------------------------------------------
+    CollisionShape::~CollisionShape()
+    {
+       delete mShape;
+    }
+    // -------------------------------------------------------------------------
+    bool CollisionShape::drawWireFrame(DebugLines *wire, const Vector3 &pos, const Quaternion &quat) const
+    {   
+        if (mShape->isConvex ())
+            return drawConvexWireFrame (wire, pos, quat);
+
+        return false;
+    }
+    // -------------------------------------------------------------------------
+    bool CollisionShape::drawConvexWireFrame(DebugLines *wire, const Vector3 &pos, const Quaternion &quat) const
+    {   
+        assert (mShape->isConvex ());
+        
+        const btConvexShape * const s = static_cast <btConvexShape *> (mShape);
+
+        Vector3 lastVec;
+        bool sideBeginning;
+
+        #define getVertex(X,Y,Z) BtOgreConverter::to(s->localGetSupportingVertex (btVector3(X,Y,Z)))
+
+        const bool hasVecTransform = (pos != Vector3::ZERO);
+        const bool hasQuatTransform = (quat != Quaternion::IDENTITY);
+        const bool hasTransform = (hasVecTransform) || (hasQuatTransform);
+
+        Vector3 curVec;
+        size_t i = 0;
+        const int subDivisionCount = 1;
+        const float subDivide = 1.0f / subDivisionCount;
+        for (int x = -subDivisionCount; x <= subDivisionCount; x++)
+        {
+            for (int y = -subDivisionCount; y <= subDivisionCount; y++)
+            {
+                sideBeginning = true;
+                for (int z = -subDivisionCount; z <= subDivisionCount; z++)
+                {
+                    curVec = getVertex(x*subDivide, y*subDivide, z*subDivide);
+                    if (hasTransform)
+                    {
+                        // apply transformation
+                        if (hasQuatTransform) 
+                            curVec = quat * curVec;
+                        if (hasVecTransform) 
+                            curVec += pos;
+//                        if (hasVecTransform) 
+//                            curVec -= pos;
+//                        if (hasQuatTransform) 
+//                            curVec = quat * curVec;
+                    }
+
+                    if (sideBeginning)
+                        sideBeginning = false;
+                    else
+                        wire->addLine (lastVec, curVec);
+                    lastVec = curVec;
+
+                    i++;
+                }
+            }
+        }
+
+
+        for (int x = -subDivisionCount; x <= subDivisionCount; x++)
+        {
+            for (int z = -subDivisionCount; z <= subDivisionCount; z++)
+            {
+                sideBeginning = true;
+                for (int y = -subDivisionCount; y <= subDivisionCount; y++)
+                {
+                    curVec = getVertex(x*subDivide, y*subDivide, z*subDivide);
+                    if (hasTransform)
+                    {
+                        // apply transformation
+                        if (hasVecTransform) 
+                            curVec -= pos;
+                        if (hasQuatTransform) 
+                            curVec = quat * curVec;
+                    }
+
+                    if (sideBeginning)
+                        sideBeginning = false;
+                    else
+                        wire->addLine (lastVec, curVec);
+                    lastVec = curVec;
+
+                    i++;
+                }
+            }
+        }
+
+
+
+        for (int z = -subDivisionCount; z <= subDivisionCount; z++)
+        {
+            for (int y = -subDivisionCount; y <= subDivisionCount; y++)
+            {
+                sideBeginning = true;
+                for (int x = -subDivisionCount; x <= subDivisionCount; x++)
+                {
+                    curVec = getVertex(x*subDivide, y*subDivide, z*subDivide);
+                    if (hasTransform)
+                    {
+                        // apply transformation
+                        if (hasVecTransform) 
+                            curVec -= pos;
+                        if (hasQuatTransform) 
+                            curVec = quat * curVec;
+                    }
+
+                    if (sideBeginning)
+                        sideBeginning = false;
+                    else
+                        wire->addLine (lastVec, curVec);
+                    lastVec = curVec;
+
+                    i++;
+                }
+            }
+        }
+#undef getVertex
+
+        return true;
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsShape.h	(revision 1971)
@@ -0,0 +1,57 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_Shape_H
+#define _OGREBULLETCOLLISIONS_Shape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic Shape
+    class CollisionShape 
+    {
+
+    public:
+	    CollisionShape();
+        virtual ~CollisionShape();
+        
+        inline btCollisionShape* getBulletShape () {return mShape;};
+
+        virtual bool drawWireFrame(DebugLines *wire, 
+            const Ogre::Vector3 &pos = Ogre::Vector3::ZERO, 
+            const Ogre::Quaternion &quat= Ogre::Quaternion::IDENTITY) const;
+
+    protected:
+        btCollisionShape*       mShape;        
+        bool drawConvexWireFrame(DebugLines *wire, const Ogre::Vector3 &pos, const Ogre::Quaternion &quat) const;
+
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_Shape_H
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsWorld.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsWorld.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsWorld.cpp	(revision 1971)
@@ -0,0 +1,238 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "OgreBulletCollisionsWorld.h"
+#include "Utils/OgreBulletConverter.h"
+
+#include "OgreBulletCollisionsObject.h"
+#include "Debug/OgreBulletCollisionsDebugShape.h"
+#include "OgreBulletCollisionsRay.h"
+
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    CollisionsWorld::CollisionsWorld(SceneManager *scn, const AxisAlignedBox &bounds, bool init, bool set32bitsAxisSweep):
+        mScnMgr(scn),
+        mBounds(bounds),
+        mShowDebugShapes(false),
+        mShowDebugContactPoints(false),
+        mDebugContactPoints(0)
+	{
+        mDispatcher = new btCollisionDispatcher(&mDefaultCollisionConfiguration);
+
+		if (set32bitsAxisSweep)
+		{
+			mBroadphase = new bt32BitAxisSweep3(
+				OgreBtConverter::to(bounds.getMinimum()), 
+				OgreBtConverter::to(bounds.getMaximum()));
+		}
+		else
+		{
+			mBroadphase = new btAxisSweep3(
+				OgreBtConverter::to(bounds.getMinimum()), 
+				OgreBtConverter::to(bounds.getMaximum()));
+		}
+
+        // if not called by a inherited class
+        if (init)
+		{
+			mWorld = new btCollisionWorld(mDispatcher, mBroadphase, &mDefaultCollisionConfiguration);
+
+			btCollisionDispatcher * dispatcher = static_cast<btCollisionDispatcher *>(mWorld->getDispatcher());
+			btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);
+		}
+    }
+    // -------------------------------------------------------------------------
+    CollisionsWorld::~CollisionsWorld()
+    {
+        delete mWorld;
+		delete mBroadphase;
+        delete mDispatcher;
+    }
+    // -------------------------------------------------------------------------
+    void CollisionsWorld::setShowDebugContactPoints(bool show)
+    {
+        if (show && !mShowDebugContactPoints)
+        {
+            assert (mDebugContactPoints == 0);
+
+            mShowDebugContactPoints = true;
+            return;
+        }
+        if (!show && mShowDebugContactPoints)
+        {
+            assert (mDebugContactPoints != 0);
+
+            mShowDebugContactPoints = false;
+            return;
+        }
+    }
+    // -------------------------------------------------------------------------
+    void CollisionsWorld::setShowDebugShapes(bool show)
+    {
+        if (show && !mShowDebugShapes)
+        {
+            //assert (mDebugShapes == 0);
+            std::deque<Object*>::iterator it = mObjects.begin();
+            while (it != mObjects.end())
+            {
+                (*it)->showDebugShape(show);
+                ++it;
+            }
+            mShowDebugShapes = true;
+            return;
+        }
+        if (!show && mShowDebugShapes)
+        {
+            //assert (mDebugShapes != 0);
+            std::deque<Object*>::iterator it = mObjects.begin();
+            while (it != mObjects.end())
+            {
+                (*it)->showDebugShape(show);
+                ++it;
+            }
+            mShowDebugShapes = false;
+            return;
+        }
+    }
+    // -------------------------------------------------------------------------
+    void CollisionsWorld::addObject(Object *obj)
+    {
+        mObjects.push_back (obj);
+        mWorld->addCollisionObject(obj->getBulletObject());
+    }
+    //------------------------------------------------------------------------- 
+	bool CollisionsWorld::removeObject(Object *obj)
+    {
+       std::deque<Object*>::iterator it = find(mObjects.begin(),mObjects.end(), obj);
+       if (it == mObjects.end())
+          return false;
+       mObjects.erase(it);
+       return true;
+    }
+    // -------------------------------------------------------------------------
+    bool CollisionsWorld::isObjectregistered(Object *obj) const
+    {
+        std::deque<Object *>::const_iterator itRes = std::find(mObjects.begin(), mObjects.end(), obj);
+        if (itRes != mObjects.end())
+            return true;
+        return false;
+    }
+    // -------------------------------------------------------------------------
+    Object *CollisionsWorld::findObject(btCollisionObject *object) const
+    {
+        std::deque<Object *>::const_iterator it = mObjects.begin();
+        while (it != mObjects.end())
+        {
+            if ((*it)->getBulletObject() == object)
+                return (*it);
+            ++it;
+        }
+        return 0;
+    }
+    // -------------------------------------------------------------------------
+    Object *CollisionsWorld::findObject(SceneNode *node) const
+    {
+        std::deque<Object *>::const_iterator it = mObjects.begin();
+        while (it != mObjects.end())
+        {
+            //if ((*it)->getParentNode() == node)
+			if((*it)->getRootNode() == node)
+                return (*it);
+            ++it;
+        }
+        return 0;
+    }
+    // -------------------------------------------------------------------------
+    void CollisionsWorld::discreteCollide()
+    {
+        mWorld->performDiscreteCollisionDetection();
+
+
+        ///one way to draw all the contact points is iterating over contact manifolds / points:
+        const unsigned int  numManifolds = mWorld->getDispatcher()->getNumManifolds();
+        for (unsigned int i=0;i < numManifolds; i++)
+        {
+            btPersistentManifold* contactManifold = mWorld->getDispatcher()->getManifoldByIndexInternal(i);
+
+            btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
+            btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
+
+            contactManifold->refreshContactPoints(obA->getWorldTransform(),obB->getWorldTransform());
+
+            const unsigned int numContacts = contactManifold->getNumContacts();
+            for (unsigned int j = 0;j < numContacts; j++)
+            {
+                btManifoldPoint& pt = contactManifold->getContactPoint(j);
+
+                if (mShowDebugContactPoints)
+                {
+                    btVector3 ptA = pt.getPositionWorldOnA();
+                    btVector3 ptB = pt.getPositionWorldOnB();
+
+                    mDebugContactPoints->addLine(ptA.x(),ptA.y(),ptA.z(),
+                                                     ptB.x(),ptB.y(),ptB.z());
+                }
+            }
+            //you can un-comment out this line, and then all points are removed
+            //contactManifold->clearManifold();	
+        }
+
+        /*
+        if (mShowDebugShapes)
+        {
+            std::deque<Object*>::iterator it = mObjects.begin();
+            while (it != mObjects.end())
+            {
+
+                //(*it)->getBulletObject()->getWorldTransform().getOpenGLMatrix( m );
+                mShowDebugDrawShapes->
+                //GL_ShapeDrawer::drawOpenGL(m,objects[i].getCollisionShape(),btVector3(1,1,1),getDebugMode());
+
+                ++it;
+            }
+        }
+        */
+    }
+
+    // -------------------------------------------------------------------------
+    void CollisionsWorld::launchRay(CollisionRayResultCallback &rayresult, short int collisionFilterMask)
+    {
+        mWorld->rayTest(
+            OgreBtConverter::to(rayresult.getRayStartPoint()), 
+            OgreBtConverter::to(rayresult.getRayEndPoint()), 
+            *rayresult.getBulletRay ()
+			//, collisionFilterMask
+			);
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletCollisionsWorld.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletCollisionsWorld.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletCollisionsWorld.h	(revision 1971)
@@ -0,0 +1,89 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_CollisionWorld_H
+#define _OGREBULLETCOLLISIONS_CollisionWorld_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic CollisionWorld
+    class CollisionsWorld 
+    {
+    public:
+        CollisionsWorld(Ogre::SceneManager *scn, const Ogre::AxisAlignedBox &bounds, bool init = true, bool set32bitsAxisSweep = true);
+	    virtual ~CollisionsWorld();
+
+        void addObject(Object *obj);
+
+		/// Returns false if obj was not found.
+		bool removeObject(Object *obj);
+
+        void discreteCollide();
+
+        bool isObjectregistered(Object *) const;
+        Object *findObject(Ogre::SceneNode *node) const;
+        Object *findObject(btCollisionObject *object) const;
+
+
+        // mShowDebugContactPoints getter
+        bool getShowDebugContactPoints() const { return mShowDebugContactPoints; }
+        // mShowDebugContactPoints setter
+        void setShowDebugContactPoints(bool show);
+        // mShowDebugShapes getter
+        bool getShowDebugShapes() const { return mShowDebugShapes; }
+        // mShowDebugShapes setter
+        void setShowDebugShapes(bool val);
+
+        Ogre::SceneManager *getSceneManager() const {return mScnMgr;}
+        btCollisionWorld *getBulletCollisionWorld() const {return mWorld;}
+
+        void launchRay (CollisionRayResultCallback &ray, short int collisionFilterMask = -1);
+
+    protected:
+        btCollisionWorld*          mWorld;
+        btCollisionDispatcher*     mDispatcher;
+
+		btBroadphaseInterface*	   mBroadphase;
+
+        Ogre::AxisAlignedBox       mBounds;
+
+		btDefaultCollisionConfiguration	mDefaultCollisionConfiguration;
+
+        std::deque<Object *>        mObjects;
+
+        bool                        mShowDebugShapes;
+        bool                        mShowDebugContactPoints;
+        DebugLines *                mDebugContactPoints;
+
+        Ogre::SceneManager *        mScnMgr;
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_CollisionWorld_H
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamics.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamics.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamics.h	(revision 1971)
@@ -0,0 +1,50 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETDYNAMICS_H
+#define _OGREBULLETDYNAMICS_H
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+#ifdef _PRECOMP
+
+    #include "OgreBulletDynamicsRigidBody.h"
+    #include "OgreBulletDynamicsObjectState.h"
+
+    #include "OgreBulletDynamicsConstraint.h"
+    #include "Constraints/OgreBulletDynamics6DofConstraint.h"
+    #include "Constraints/OgreBulletDynamicsHingeConstraint.h"
+    #include "Constraints/OgreBulletDynamicsPoint2pointConstraint.h"
+	#include "Constraints/OgreBulletDynamicsConeTwistConstraint.h"
+
+	#include "Constraints/OgreBulletDynamicsRaycastVehicle.h"
+	#include "Prefab/OgreBulletDynamicsRagDoll.h"
+
+    #include "OgreBulletDynamicsWorld.h"
+
+#endif //_PRECOMP
+ 
+#endif //_OGREBULLETDYNAMICS_H
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamicsConstraint.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamicsConstraint.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamicsConstraint.cpp	(revision 1971)
@@ -0,0 +1,78 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletDynamics.h"
+
+#include "OgreBulletDynamicsConstraint.h"
+
+#include "OgreBulletDynamicsWorld.h"
+
+#include "OgreBulletDynamicsRigidBody.h"
+
+using namespace Ogre;
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    TypedConstraint::TypedConstraint(DynamicsWorld *world) :
+            mConstraint (0),
+            mWorld (world),
+            mBodyA (0),
+            mBodyB (0)
+    {
+    }
+    // -------------------------------------------------------------------------
+    TypedConstraint::TypedConstraint(RigidBody *bodyA) :
+            mConstraint(0),
+            mWorld(bodyA->getDynamicsWorld()),
+            mBodyA (bodyA),
+            mBodyB (0)
+    {
+            mBodyA = bodyA;
+    }
+    // -------------------------------------------------------------------------
+    TypedConstraint::TypedConstraint(RigidBody *bodyA, RigidBody *bodyB) :
+            mConstraint(0),
+            mWorld(bodyA->getDynamicsWorld()),
+            mBodyA (bodyA),
+            mBodyB (bodyB)
+    {
+        assert (bodyA->getDynamicsWorld() == bodyB->getDynamicsWorld());
+        mBodyA = bodyA;
+        mBodyB = bodyB;
+    }
+    // -------------------------------------------------------------------------
+    TypedConstraint::~TypedConstraint()
+    {
+        if (mConstraint)
+        {
+            assert (mWorld->isConstraintRegistered (this) == false);
+            delete mConstraint;
+        }
+    }
+    // -------------------------------------------------------------------------
+
+}
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamicsConstraint.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamicsConstraint.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamicsConstraint.h	(revision 1971)
@@ -0,0 +1,58 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+#ifndef _OGREBULLETDYNAMICS_TypedConstraint_H
+#define _OGREBULLETDYNAMICS_TypedConstraint_H
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+#include "OgreBulletCollisionsObject.h"
+
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    // basic constraint class
+    class TypedConstraint
+    {
+    public:
+        TypedConstraint(DynamicsWorld *world);
+        TypedConstraint(RigidBody *bodyA);
+        TypedConstraint(RigidBody *bodyA, RigidBody *bodyB);
+
+	    virtual ~TypedConstraint();
+
+
+        inline btTypedConstraint* getBulletTypedConstraint() const {return static_cast <btTypedConstraint*> (mConstraint);};
+
+    protected:
+        btTypedConstraint       *mConstraint;
+
+        DynamicsWorld           *mWorld;
+        RigidBody               *mBodyA;
+        RigidBody               *mBodyB;
+    };
+}
+#endif //_OGREBULLETDYNAMICS_TypedConstraint_H
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamicsObjectState.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamicsObjectState.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamicsObjectState.cpp	(revision 1971)
@@ -0,0 +1,65 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletDynamics.h"
+
+#include "OgreBulletDynamicsObjectState.h"
+#include "OgreBulletDynamicsRigidBody.h"
+
+using namespace Ogre;
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    PhysicState::PhysicState(RigidBody *parent)
+        :	
+      btMotionState(),
+        mObject(parent)
+    {
+    }
+    // -------------------------------------------------------------------------
+    PhysicState::~PhysicState()
+    {
+    }
+    // -------------------------------------------------------------------------
+    void PhysicState::getWorldTransform(btTransform& worldTrans ) const
+    {
+        assert (mObject);
+        
+        worldTrans.setOrigin(OgreBulletCollisions::OgreBtConverter::to(mObject->getWorldPosition()));
+        worldTrans.setRotation(OgreBulletCollisions::OgreBtConverter::to(mObject->getWorldOrientation()));
+        
+    }
+    // -------------------------------------------------------------------------
+    void PhysicState::setWorldTransform(const btTransform& worldTrans)
+    {
+        assert (mObject);
+
+        mObject->setPosition(OgreBulletCollisions::BtOgreConverter::to(worldTrans.getOrigin()));
+        mObject->setOrientation(OgreBulletCollisions::BtOgreConverter::to(worldTrans.getRotation()));
+        
+    }
+}
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamicsObjectState.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamicsObjectState.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamicsObjectState.h	(revision 1971)
@@ -0,0 +1,51 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETDYNAMICS_PhysicState_H
+#define _OGREBULLETDYNAMICS_PhysicState_H
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    // Object transforms
+    class PhysicState : public btMotionState
+    {
+    public:
+	    PhysicState(RigidBody *parent);
+	    ~PhysicState();
+
+	    virtual void getWorldTransform(btTransform& worldTrans ) const;
+	    virtual void setWorldTransform(const btTransform& worldTrans);	
+    
+    protected:
+        RigidBody *mObject;
+    };
+}
+#endif //_OGREBULLETDYNAMICS_PhysicState_H
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamicsPreRequisites.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamicsPreRequisites.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamicsPreRequisites.h	(revision 1971)
@@ -0,0 +1,58 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETDYNAMICS_PREREQUISITES_H
+#define _OGREBULLETDYNAMICS_PREREQUISITES_H
+
+#include "btBulletCollisionCommon.h"
+#include "btBulletDynamicsCommon.h"
+
+#include "Ogre.h"
+#include "OgreBulletCollisions.h"
+
+
+namespace OgreBulletDynamics
+{
+    class RigidBody;
+    class PhysicState;
+    class DynamicsWorld;
+
+    class TypedConstraint;
+    class HingeConstraint;
+    class SixDofConstraint;
+    class PointToPointConstraint;
+	class ConeTwistConstraint;
+
+    class WheeledRigidBody;
+    class VehicleRayCaster;
+    class VehicleTuning;
+    class RaycastVehicle;
+    class WheelInfo;
+
+	class RagDoll;
+}
+
+#endif //_OGREBULLETDYNAMICS_PREREQUISITES_H
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamicsPrecompiled.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamicsPrecompiled.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamicsPrecompiled.cpp	(revision 1971)
@@ -0,0 +1,27 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletDynamics.h"
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamicsRigidBody.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamicsRigidBody.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamicsRigidBody.cpp	(revision 1971)
@@ -0,0 +1,224 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletDynamics.h"
+
+#include "OgreBulletCollisionsShape.h"
+#include "OgreBulletCollisionsObject.h"
+#include "OgreBulletCollisionsWorld.h"
+#include "OgreBulletCollisionsObjectState.h"
+
+#include "OgreBulletDynamicsWorld.h"
+#include "OgreBulletDynamicsRigidBody.h"
+#include "OgreBulletDynamicsObjectState.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletDynamics
+{
+
+    // -------------------------------------------------------------------------
+    RigidBody::RigidBody(const String &name, DynamicsWorld *world, const short collisionGroup, const short collisionMask)
+        :	
+        Object(name, world, false)
+    {
+		mCollisionGroup = collisionGroup;
+		mCollisionMask = collisionMask;
+    }
+    // -------------------------------------------------------------------------
+    RigidBody::~RigidBody()
+    {
+    }  
+    // -------------------------------------------------------------------------
+    void RigidBody::setShape(Ogre::SceneNode *node,  
+        OgreBulletCollisions::CollisionShape *shape,                          
+        const float      bodyRestitution,
+        const float      bodyFriction,
+        const float      bodyMass,
+        const Vector3 &pos, 
+        const Quaternion &quat)
+    {
+
+        mState = new ObjectState(this);
+
+        mRootNode = node;
+        mShapeNode = mRootNode->createChildSceneNode(mName + "Node");
+        mShapeNode->attachObject(this);
+
+        node->setPosition (pos);
+        node->setOrientation (quat);
+
+        mShape = shape;
+        showDebugShape(mWorld->getShowDebugShapes());
+
+        btVector3 localInertiaTensor = btVector3(0,0,0);
+		if (bodyMass > 0.0)
+	        mShape->getBulletShape ()->calculateLocalInertia(bodyMass, localInertiaTensor);
+
+        btRigidBody *body = new btRigidBody(bodyMass, mState, mShape->getBulletShape (), localInertiaTensor);
+        body->setRestitution(bodyRestitution);
+        body->setFriction(bodyFriction);
+
+        mObject = body;
+
+		getDynamicsWorld()->addRigidBody(this, mCollisionGroup, mCollisionMask);
+    }
+
+    // -------------------------------------------------------------------------
+    void RigidBody::setStaticShape(Ogre::SceneNode *node, 
+        OgreBulletCollisions::CollisionShape *shape,
+        const float      bodyRestitution,
+        const float      bodyFriction,
+        const Vector3 &pos, 
+        const Quaternion &quat)
+    {
+        mState = new ObjectState(this);
+
+        mRootNode = node;
+
+        mShapeNode = mRootNode->createChildSceneNode(mName + "Node");
+        mShapeNode->attachObject(this);
+
+        node->setPosition (pos);
+        node->setOrientation (quat);
+
+        mShape = shape;
+        showDebugShape(mWorld->getShowDebugShapes());
+
+        btRigidBody *body = new btRigidBody(0.0, mState, mShape->getBulletShape ());
+
+        body->setRestitution(bodyRestitution);
+        body->setFriction(bodyFriction);
+
+        body->getWorldTransform().setOrigin(btVector3(pos.x, pos.y, pos.z));
+        body->getWorldTransform().setRotation(btQuaternion(quat.x, quat.y, quat.z, quat.w));
+
+        mObject = body;
+		getDynamicsWorld()->addRigidBody(this, mCollisionGroup, mCollisionMask);
+    }
+    // -------------------------------------------------------------------------
+    void RigidBody::setStaticShape(OgreBulletCollisions::CollisionShape *shape,
+        const float      bodyRestitution,
+        const float      bodyFriction,
+        const Vector3 &pos, 
+        const Quaternion &quat)
+    {
+        //mState = new ObjectState(this);
+
+        mShape = shape;
+        btRigidBody *body = new btRigidBody(0.0, 0, mShape->getBulletShape ());
+
+        body->setRestitution(bodyRestitution);
+        body->setFriction(bodyFriction);
+
+        body->getWorldTransform().setOrigin(btVector3(pos.x, pos.y, pos.z));
+        body->getWorldTransform().setRotation(btQuaternion(quat.x, quat.y, quat.z, quat.w));
+
+        mObject = body;
+		getDynamicsWorld()->addRigidBody(this, mCollisionGroup, mCollisionMask);
+	}
+	// -------------------------------------------------------------------------
+	void RigidBody::setKinematicObject(bool isKinematic) {
+		if (this->isKinematicObject() != isKinematic) {
+			//flip kinematic state
+			getBulletRigidBody()->setCollisionFlags(
+				getBulletRigidBody()->getCollisionFlags() ^ btCollisionObject::CF_KINEMATIC_OBJECT);
+		}
+	} 
+    // -------------------------------------------------------------------------
+    void RigidBody::setLinearVelocity( const Ogre::Vector3 &vel )
+    {
+        getBulletRigidBody()->setLinearVelocity (btVector3(vel.x, vel.y, vel.z));
+    }
+    // -------------------------------------------------------------------------
+    void RigidBody::setLinearVelocity( const Ogre::Real x, const Ogre::Real y, const Ogre::Real z )
+    {
+        getBulletRigidBody()->setLinearVelocity (btVector3(x, y, z));
+    }
+    // -------------------------------------------------------------------------
+	Ogre::Vector3 RigidBody::getLinearVelocity()
+	{
+		const btVector3 lv = getBulletRigidBody()->getLinearVelocity();
+		return BtOgreConverter::to(lv);
+	}
+    // -------------------------------------------------------------------------
+    void RigidBody::applyImpulse( const Ogre::Vector3 &impulse, const Ogre::Vector3 &position )
+    {
+        getBulletRigidBody()->applyImpulse (OgreBtConverter::to(impulse), OgreBtConverter::to(position));
+    }
+    // -------------------------------------------------------------------------
+    void RigidBody::applyForce( const Ogre::Vector3 &impulse, const Ogre::Vector3 &position )
+    {
+        getBulletRigidBody()->applyForce(OgreBtConverter::to(impulse), OgreBtConverter::to(position));
+    }
+    // -------------------------------------------------------------------------
+    Ogre::Vector3 RigidBody::getCenterOfMassPivot( const Ogre::Vector3 &pivotPosition ) const
+    {
+        const btVector3 centerOfMassPivot(getCenterOfMassTransform().inverse()* OgreBtConverter::to(pivotPosition));
+        return BtOgreConverter::to(centerOfMassPivot);
+    }
+    // -------------------------------------------------------------------------
+    void RigidBody::setDeactivationTime( const float ftime )
+    {
+        getBulletRigidBody()->setDeactivationTime( ftime );
+    }
+    // -------------------------------------------------------------------------
+    void RigidBody::setDamping( const Ogre::Real linearDamping, const Ogre::Real angularDamping )
+    {
+        getBulletRigidBody()->setDamping( linearDamping,  angularDamping);
+    }
+    // -------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
+    void WheeledRigidBody::setPosition(const btVector3 &pos)
+    { 
+        //should update wheels as well ?
+        mRootNode->setPosition(pos[0], pos[1], pos[2]);
+    };
+    // -------------------------------------------------------------------------
+    void WheeledRigidBody::setOrientation(const btQuaternion &quat)
+    { 
+        mRootNode->setOrientation(quat.getW(),quat.getX(), quat.getY(), quat.getZ());
+    };
+    // -------------------------------------------------------------------------
+    void WheeledRigidBody::setTransform(const btVector3 &pos, const btQuaternion &quat)
+    {
+        mRootNode->setPosition(pos[0], pos[1], pos[2]);
+        mRootNode->setOrientation(quat.getW(),quat.getX(), quat.getY(), quat.getZ());
+
+        mVehicle->setTransform();
+    }
+    // -------------------------------------------------------------------------
+    void WheeledRigidBody::setTransform(const btTransform& worldTrans)
+    { 
+        mRootNode->setPosition(worldTrans.getOrigin()[0], worldTrans.getOrigin()[1],worldTrans.getOrigin()[2]);
+        mRootNode->setOrientation(worldTrans.getRotation().getW(),worldTrans.getRotation().getX(), worldTrans.getRotation().getY(), worldTrans.getRotation().getZ());
+
+        mVehicle->setTransform();
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamicsRigidBody.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamicsRigidBody.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamicsRigidBody.h	(revision 1971)
@@ -0,0 +1,197 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETDYNAMICS_RigidObject_H
+#define _OGREBULLETDYNAMICS_RigidObject_H
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+#include "OgreBulletCollisionsObject.h"
+#include "OgreBulletCollisionsWorld.h"
+#include "Utils/OgreBulletConverter.h"
+
+#include "OgreBulletDynamicsWorld.h"
+
+#include "Constraints/OgreBulletDynamicsRaycastVehicle.h"
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    // basic rigid body class
+    class RigidBody : public OgreBulletCollisions::Object
+    {
+    public:
+	    RigidBody(const Ogre::String &name, 
+				  DynamicsWorld *world,
+				  const short collisionGroup = 0,
+				  const short collisionMask = 0);
+
+	    virtual ~RigidBody();
+
+        void setShape(Ogre::SceneNode *node, 
+            OgreBulletCollisions::CollisionShape *shape,
+            const float      bodyRestitution,
+            const float      bodyFriction,
+            const float      bodyMass,
+            const Ogre::Vector3 &pos = Ogre::Vector3::ZERO, 
+            const Ogre::Quaternion &quat = Ogre::Quaternion::IDENTITY);
+
+        void setStaticShape(Ogre::SceneNode *node,
+            OgreBulletCollisions::CollisionShape *shape,
+            const float      bodyRestitution,
+            const float      bodyFriction,
+            const Ogre::Vector3 &pos = Ogre::Vector3::ZERO, 
+            const Ogre::Quaternion &quat = Ogre::Quaternion::IDENTITY);
+
+        void setStaticShape(OgreBulletCollisions::CollisionShape *shape,
+            const float      bodyRestitution,
+            const float      bodyFriction,
+            const Ogre::Vector3 &pos = Ogre::Vector3::ZERO, 
+            const Ogre::Quaternion &quat = Ogre::Quaternion::IDENTITY);
+
+
+        void setLinearVelocity(const Ogre::Vector3 &vel);
+        void setLinearVelocity(const Ogre::Real x, const Ogre::Real y, const Ogre::Real z);
+		Ogre::Vector3 getLinearVelocity();
+        void applyImpulse(const Ogre::Vector3 &impulse, const Ogre::Vector3 &position);
+        void applyForce(const Ogre::Vector3 &impulse, const Ogre::Vector3 &position);
+
+
+        inline btRigidBody*         getBulletRigidBody() const;
+        inline btDynamicsWorld*     getBulletDynamicsWorld() const;
+        inline DynamicsWorld*       getDynamicsWorld();
+
+        Ogre::SceneNode*  getSceneNode() const {return mRootNode;};
+
+        inline bool isStaticObject() const;
+        inline bool isKinematicObject() const;
+
+		void setKinematicObject(bool isKinematic);
+
+        inline void disableDeactivation();
+        inline void enableActiveState ();
+        inline void forceActivationState();
+        void setDeactivationTime(const float ftime);
+
+        inline const btTransform &getCenterOfMassTransform() const;
+        inline Ogre::Quaternion    getCenterOfMassOrientation () const;
+        inline Ogre::Vector3 getCenterOfMassPosition() const;
+
+        Ogre::Vector3       getCenterOfMassPivot (const Ogre::Vector3 &pivotPosition) const;
+        
+        void setDamping( const Ogre::Real linearDamping, const Ogre::Real angularDamping );
+	protected:
+		short mCollisionGroup;
+		short mCollisionMask;
+    };
+    // -------------------------------------------------------------------------
+    // basic rigid body class
+    class WheeledRigidBody : public RigidBody
+    {
+    public:
+        WheeledRigidBody(const Ogre::String &name, DynamicsWorld *world): 
+            RigidBody(name, world),
+                mVehicle(0)
+        {
+        };
+
+        
+        void setVehicle(RaycastVehicle *v){mVehicle = v;};
+
+       virtual void setPosition(const btVector3 &pos);
+       virtual void setOrientation(const btQuaternion &quat);
+       virtual void setTransform(const btVector3 &pos, const btQuaternion &quat);
+       virtual void setTransform(const btTransform& worldTrans);
+
+        virtual ~WheeledRigidBody(){};
+
+    protected:
+		RaycastVehicle *mVehicle;
+
+    };
+    // -------------------------------------------------------------------------
+    // basic rigid body class inline methods
+    // -------------------------------------------------------------------------
+    inline btRigidBody*  RigidBody::getBulletRigidBody() const 
+    {
+        return static_cast <btRigidBody* > (mObject);
+    };
+    // -------------------------------------------------------------------------
+    inline btDynamicsWorld*     RigidBody::getBulletDynamicsWorld() const 
+    { 
+        return static_cast <btDynamicsWorld * > (mWorld->getBulletCollisionWorld ());
+    };
+    // -------------------------------------------------------------------------
+    inline DynamicsWorld*       RigidBody::getDynamicsWorld() 
+    { 
+        return static_cast <DynamicsWorld* > (mWorld);
+    };
+    // -------------------------------------------------------------------------
+    inline bool RigidBody::isStaticObject() const 
+    {
+        return getBulletRigidBody()->isStaticObject();
+    }
+    // -------------------------------------------------------------------------
+    inline bool RigidBody::isKinematicObject() const 
+    {
+        return getBulletRigidBody()->isKinematicObject();
+    };
+    // -------------------------------------------------------------------------
+    inline void RigidBody::disableDeactivation()
+    {
+        getBulletRigidBody()->setActivationState(DISABLE_DEACTIVATION);
+    }
+    // -------------------------------------------------------------------------
+    inline void RigidBody::enableActiveState()
+    {
+        getBulletRigidBody()->setActivationState(ACTIVE_TAG);
+    }
+    // -------------------------------------------------------------------------
+    inline void RigidBody::forceActivationState()
+    {
+        getBulletRigidBody()->forceActivationState(ACTIVE_TAG);
+    }
+    // -------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
+    inline const btTransform &RigidBody::getCenterOfMassTransform() const
+    {
+        return getBulletRigidBody()->getCenterOfMassTransform();
+    }
+    // -------------------------------------------------------------------------
+    inline Ogre::Quaternion RigidBody::getCenterOfMassOrientation() const
+    {
+        return OgreBulletCollisions::BtOgreConverter::to(getCenterOfMassTransform().getRotation ());
+    }
+    // -------------------------------------------------------------------------
+    inline Ogre::Vector3 RigidBody::getCenterOfMassPosition() const
+    {
+        return OgreBulletCollisions::BtOgreConverter::to(getBulletRigidBody()->getCenterOfMassPosition());
+    }
+    // -------------------------------------------------------------------------   
+    
+}
+#endif //_OGREBULLETDYNAMICS_RigidObject_H
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamicsWorld.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamicsWorld.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamicsWorld.cpp	(revision 1971)
@@ -0,0 +1,160 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletDynamics.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+#include "OgreBulletDynamicsWorld.h"
+#include "OgreBulletDynamicsObjectState.h"
+#include "OgreBulletDynamicsRigidBody.h"
+#include "OgreBulletDynamicsConstraint.h"
+
+#include "Constraints/OgreBulletDynamicsRaycastVehicle.h"
+
+#include "BulletCollision/GIMPACT/btGImpactShape.h"
+#include "BulletCollision/GIMPACT/btGImpactCollisionAlgorithm.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletDynamics
+{
+
+    DynamicsWorld::DynamicsWorld(Ogre::SceneManager *mgr, 
+                const Ogre::AxisAlignedBox &bounds,  
+                const Ogre::Vector3 &gravity,
+                bool init) :
+        CollisionsWorld(mgr, bounds, false),
+            mDebugDrawer(0)
+    {
+        //btSequentialImpulseConstraintSolver
+        //btSequentialImpulseConstraintSolver3
+        mConstraintsolver = new btSequentialImpulseConstraintSolver();
+
+        //only if init is true, otherwise you have to create mWorld manually later on
+        if (init) {
+            mWorld = new btDiscreteDynamicsWorld(mDispatcher, mBroadphase, mConstraintsolver, &mDefaultCollisionConfiguration);
+			static_cast <btDiscreteDynamicsWorld *> (mWorld)->setGravity(btVector3(gravity.x,gravity.y,gravity.z));
+
+			btCollisionDispatcher * dispatcher = static_cast<btCollisionDispatcher *>(mWorld->getDispatcher());
+			btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);
+		}
+
+    }
+    // -------------------------------------------------------------------------
+    DynamicsWorld::~DynamicsWorld()
+    {
+        delete mConstraintsolver;
+    }
+
+    // -------------------------------------------------------------------------
+    void DynamicsWorld::addRigidBody (RigidBody *rb, short collisionGroup, short collisionMask)
+    {
+        mObjects.push_back (static_cast <Object *> (rb));
+
+		if (collisionGroup == 0 && collisionMask == 0)
+		{
+			// use default collision group/mask values (dynamic/kinematic/static)
+			static_cast <btDiscreteDynamicsWorld *> (mWorld)->addRigidBody(rb->getBulletRigidBody());      
+		}
+		else
+		{
+			static_cast <btDiscreteDynamicsWorld *> (mWorld)->addRigidBody(rb->getBulletRigidBody(), collisionGroup, collisionMask);      
+		}
+    }
+    // -------------------------------------------------------------------------
+    void DynamicsWorld::stepSimulation(const Ogre::Real elapsedTime, int maxSubSteps, const Ogre::Real fixedTimestep)
+    {
+        // Reset Debug Lines
+        if (mDebugDrawer) 
+            mDebugDrawer->clear ();
+
+        static_cast <btDiscreteDynamicsWorld *> (mWorld)->stepSimulation(elapsedTime, maxSubSteps, fixedTimestep);
+
+        if (mDebugDrawer) 
+        {
+            // draw lines that step Simulation sent.
+            mDebugDrawer->draw();
+
+            const bool drawFeaturesText = (mDebugDrawer->getDebugMode () & btIDebugDraw::DBG_DrawFeaturesText) != 0;
+            if (drawFeaturesText)
+            {
+                // on all bodies we have
+                // we get all shapes and draw more information
+                //depending on mDebugDrawer mode.
+                std::deque<Object*>::iterator it = mObjects.begin();
+                while (it != mObjects.end())
+                {
+                    //(*it)->drawFeaturesText();
+                    ++it;
+                }
+            }
+        }
+    }
+    // -------------------------------------------------------------------------
+    void DynamicsWorld::removeConstraint(TypedConstraint *constraint)
+    {
+        getBulletDynamicsWorld()->removeConstraint(constraint->getBulletTypedConstraint());
+        std::deque <TypedConstraint*>::iterator it = mConstraints.begin();
+        while (it != mConstraints.end())
+        {
+            if ((*it) == constraint)
+            {
+                mConstraints.erase (it);
+                break;
+            }
+            ++it;
+        }
+    }
+    // -------------------------------------------------------------------------
+    void DynamicsWorld::addConstraint(TypedConstraint *constraint)
+    {
+        getBulletDynamicsWorld()->addConstraint(constraint->getBulletTypedConstraint());
+        mConstraints.push_back(constraint);
+    }
+    // -------------------------------------------------------------------------
+    void DynamicsWorld::addVehicle(RaycastVehicle *v)
+    {
+        getBulletDynamicsWorld()->addVehicle(v->getBulletVehicle ());
+        mConstraints.push_back(static_cast <TypedConstraint *> (v));
+
+        //mVehicles.push_back(v);
+    }
+    // -------------------------------------------------------------------------
+    bool DynamicsWorld::isConstraintRegistered(TypedConstraint *constraint) const
+    {
+        std::deque <TypedConstraint*>::const_iterator it = mConstraints.begin();
+        while (it != mConstraints.end())
+        {
+            if ((*it) == constraint)
+                return true;
+            ++it;
+        }
+        return false;
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/OgreBulletDynamicsWorld.h
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBulletDynamicsWorld.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBulletDynamicsWorld.h	(revision 1971)
@@ -0,0 +1,85 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETDYNAMICS_DynamicWorld_H
+#define _OGREBULLETDYNAMICS_DynamicWorld_H
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+#include "OgreBulletCollisionsWorld.h"
+#include "Debug/OgreBulletCollisionsDebugDrawer.h"
+
+namespace OgreBulletDynamics
+{
+    // -------------------------------------------------------------------------
+    // basic rigid body class
+    class DynamicsWorld : public OgreBulletCollisions::CollisionsWorld
+    {
+    public:
+        DynamicsWorld(Ogre::SceneManager *mgr, 
+            const Ogre::AxisAlignedBox &bounds,  
+            const Ogre::Vector3 &gravity,
+            bool init = true);
+
+	    ~DynamicsWorld();
+
+        template <class BTDNYWORLDCLASS>
+            void createBtDynamicsWorld(BTDNYWORLDCLASS *&createdWorld)
+            {
+				createdWorld = new BTDNYWORLDCLASS(mDispatcher, mBroadphase, mConstraintsolver, &mDefaultCollisionConfiguration);
+                mWorld = createdWorld;
+            }
+
+        void stepSimulation(const Ogre::Real elapsedTime, int maxSubSteps = 1, const Ogre::Real fixedTimestep = 1./60.);
+
+        void addRigidBody (RigidBody *rb, short collisionGroup, short collisionMask);
+
+        void setDebugDrawer(OgreBulletCollisions::DebugDrawer *debugdrawer)
+        {
+            mDebugDrawer = debugdrawer;
+            (static_cast <btDiscreteDynamicsWorld *> (mWorld))->setDebugDrawer(mDebugDrawer);
+        };
+
+        OgreBulletCollisions::DebugDrawer *getDebugDrawer(){return mDebugDrawer;};
+
+        inline btDynamicsWorld * getBulletDynamicsWorld() const {return static_cast<btDynamicsWorld *> (mWorld);};
+
+        void removeConstraint(TypedConstraint *constraint);
+        void addConstraint(TypedConstraint *constraint);
+        bool isConstraintRegistered(TypedConstraint *constraint) const;
+
+        void addVehicle(RaycastVehicle *v);
+
+    private:
+        OgreBulletCollisions::DebugDrawer                 *mDebugDrawer;
+
+        btConstraintSolver                                *mConstraintsolver;
+
+        std::deque <TypedConstraint *>                    mConstraints;
+    };
+}
+#endif //_OGREBULLETDYNAMICS_DynamicWorld_H
+
Index: /code/branches/physics/src/ogrebullet/OgreBullet_LGPL.txt
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBullet_LGPL.txt	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBullet_LGPL.txt	(revision 1971)
@@ -0,0 +1,514 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+
Index: /code/branches/physics/src/ogrebullet/OgreBullet_licence.txt
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBullet_licence.txt	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBullet_licence.txt	(revision 1971)
@@ -0,0 +1,24 @@
+Licence for OgreBullet
+===================
+
+Copyright 2007 Paul "Tuan Kuranes" Cheyrou-Lagrèze.
+
+This file is part of OgreBullet an integration layer between the OGRE 3D 
+graphics engine and the Bullet physic library.
+
+OgreBullet is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+OgreBullet 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 OgreBullet; see the file OgreBullet_LGPL.txt If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+
Index: /code/branches/physics/src/ogrebullet/OgreBullet_readme.txt
===================================================================
--- /code/branches/physics/src/ogrebullet/OgreBullet_readme.txt	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/OgreBullet_readme.txt	(revision 1971)
@@ -0,0 +1,69 @@
+Readme for OgreBullet
+==================
+
+Chaster's Changelog: (latest changes at top)
+============================================
+11/8/2007 - added "getLinearVelocity()" function to OgreBullet RigidBody class.
+11/1/2007 - Fix ray in demos and added CollisionClosestRayResultCallback::getCollisionNormal()
+11/1/2007 - added "applyForce()" function to OgreBullet RigidBody class.  Similar to applyImpulse().
+10/29/2007 - added fixes from Dermont for Linux Compiling.
+10/25/2007 - small syntax fix for CollisionClosestRayResultCallback().  Thanks andy
+10/24/2007 - multiple enhancements and fixes:
+		case sensitivity for OSX/Linux compiles, 
+	     	changed default world from btSimpleDynamicsWorld to btDiscreteDynamicsWorld,
+	     	added optional maxSubsteps argument for StepSimulation,
+		added optional CollisionGroup & CollisionMask bitmask arguments to RigidBody constructor,
+		removed OgreBulletCollisionsConvexCast.cpp since it doesn't seem to be used and doesn't compile,
+		added some missing paths for the project so can compile using OgreCVS instead of just OgreSDK,
+		added lib folder hierarchy with "keepme" dummy files so compile doesn't fail,
+		added various small Linux build fixes. 
+
+DOWNLOADED VERSION
+======================
+Brief build instructions follow for OgreBullet 0.2 . 
+
+1) You should have extracted this archive next to $OGRE_TOP, where $OGRE_TOP
+   is the root directory of your Ogre installation, usually named 'ogresdk'.
+   All file paths in this build environment should be relative and all the DLLs
+   and executables should get sent to the correct place upon building.
+
+2) Bullet is available from http://www.Bullet.org/ It requires that you get Latest Bullet version
+ which is actually available only in Bullet subversion repository.
+
+
+5) Use the solution OgreBullet_SDK.sln to build the  OgreBullet library with 
+    Microsoft Visual C++ 2005. The DLLs and executables will be built to the $OGRE_TOP/bin/Debug
+   and Release directories.
+
+   Simply open up that solution and perform a batch build.
+
+6) There are some scripts which should build OgreBullet under Linux in the scripts/Linux
+   directory. They are provided courtesy of Pablo, please see the Readme in that directory
+   for further details.
+
+Post On Ogre Forums for details.
+
+CVS VERSION
+======================
+Brief build instructions follow for OgreBullet CVS Version.
+Chaster (Eric Cha) has done updates to this version.  I (Chaster) will try to keep this readme file
+updated with changes as I go.
+
+1) This version of OgreBullet can be compiled against version 
+   1.4.X branch of the Ogre library aka Eihort, and version 1.5/1.6 (Shoggoth - unreleased!).
+
+2) you need to get Bullet library (version 2.64RC2 as of this writing) using subversion or SDK release. 
+   Bullet download instruction and community is available from http://www.Bullet.org/
+   
+3) you have to set the BULLET_HOME envirronment variable in Windows to the corresponding directory. 
+    If you don't use the one shipped, you'll have to make sure Bullet is compiled against 
+    the DLL version of msvcrt. 
+    Compile with "RunTime Library : Multi-threaded DLL (/MD)" and  "RunTime Library : Multi-threaded Debug DLL (/MDd)"
+
+5) Use the OgreBullet_SDK.sln solution  to build the core OgreBullet library, 
+   with Microsoft Visual C++ 2005. The DLLs and executables will be copied to
+   the ..\OgreSDK\bin\debug and  ..\OgreSDK\bin\release
+
+   Simply open up that solution and perform a batch build.
+
+Post On Ogre Forums for details.
Index: /code/branches/physics/src/ogrebullet/Prefab/OgreBulletDynamicsRagDoll.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Prefab/OgreBulletDynamicsRagDoll.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Prefab/OgreBulletDynamicsRagDoll.cpp	(revision 1971)
@@ -0,0 +1,151 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletDynamics.h"
+
+#include "OgreBulletCollisionsShape.h"
+#include "OgreBulletCollisionsObject.h"
+#include "OgreBulletCollisionsWorld.h"
+#include "OgreBulletCollisionsObjectState.h"
+
+#include "OgreBulletDynamicsWorld.h"
+#include "OgreBulletDynamicsRigidBody.h"
+#include "Prefab/OgreBulletDynamicsRagDoll.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletDynamics
+{
+
+	// -------------------------------------------------------------------------
+	RagDoll::RagDoll (btDynamicsWorld* ownerWorld, const btVector3& positionOffset)
+		: 
+		m_ownerWorld (ownerWorld)
+	{
+		// Setup all the rigid bodies
+		btTransform offset; offset.setIdentity();
+		offset.setOrigin(positionOffset);
+
+
+		btTransform transform;
+
+		// for
+		{
+			transform.setIdentity();
+			transform.setOrigin(btVector3(btScalar(0.), btScalar(1.), btScalar(0.)));
+			m_bodies.push_back(
+				localCreateRigidBody(btScalar(1.), 
+										offset*transform, 
+										new btCapsuleShape(btScalar(0.15), btScalar(0.20))
+										)
+									);
+		}
+
+		// Setup some damping on the m_bodies
+		for(std::vector<btRigidBody* >::iterator i=m_bodies.begin();
+			i!=m_bodies.end();
+			++i) 
+		{
+			(*i)->setDamping(0.05, 0.85);
+			(*i)->setDeactivationTime(0.8);
+			(*i)->setSleepingThresholds(1.6, 2.5);
+		}
+
+		// Now setup the constraints
+		btHingeConstraint* hingeC;
+		btConeTwistConstraint* coneC;
+		btTransform localA, localB;
+
+		// for
+		{
+			localA.setIdentity(); localB.setIdentity();
+			localA.getBasis().setEulerZYX(0, Ogre::Math::TWO_PI,0); 
+			localA.setOrigin(btVector3(btScalar(0.), btScalar(0.15), btScalar(0.)));
+			localB.getBasis().setEulerZYX(0,Ogre::Math::TWO_PI,0); 
+			localB.setOrigin(btVector3(btScalar(0.), btScalar(-0.15), btScalar(0.)));
+			hingeC =  new btHingeConstraint(*m_bodies[0], *m_bodies[1], 
+				localA, localB);
+			hingeC->setLimit(btScalar(-Ogre::Math::TWO_PI*2), btScalar(Ogre::Math::TWO_PI));
+			m_joints.push_back(hingeC);
+			m_ownerWorld->addConstraint(hingeC, true);
+		}
+
+	}
+    // -------------------------------------------------------------------------
+	RagDoll::~RagDoll ()
+	{
+		std::vector<btCollisionShape* >  m_shapes;
+		std::vector<btRigidBody* >		 m_bodies;
+		std::vector<btTypedConstraint* > m_joints;
+		// Remove all constraints
+		for(std::vector<btTypedConstraint* >::iterator i=m_joints.begin();
+			i!=m_joints.end();
+			++i) 
+		{
+			m_ownerWorld->removeConstraint(*i);
+			delete *i;
+		}
+
+		// Remove all bodies and shapes
+		for(std::vector<btRigidBody* >::iterator i=m_bodies.begin();
+			i!=m_bodies.end();
+			++i) 
+		{
+			m_ownerWorld->removeRigidBody(*i);
+
+			delete (*i)->getMotionState();
+			delete *i;
+		}
+		for(std::vector<btCollisionShape* >::iterator i=m_shapes.begin();
+			i!=m_shapes.end();
+			++i) 
+		{
+			delete *i;
+		}
+	}
+	// -------------------------------------------------------------------------
+	btRigidBody* RagDoll::localCreateRigidBody (btScalar mass, 
+		const btTransform& startTransform, 
+		btCollisionShape* shape)
+	{
+		bool isDynamic = (mass != 0.f);
+
+		btVector3 localInertia(0,0,0);
+		if (isDynamic)
+			shape->calculateLocalInertia(mass,localInertia);
+
+		btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform);
+
+		btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState,shape,localInertia);
+		btRigidBody* body = new btRigidBody(rbInfo);
+
+		m_ownerWorld->addRigidBody(body);
+
+		return body;
+	}
+}
+
Index: /code/branches/physics/src/ogrebullet/Prefab/OgreBulletDynamicsRagDoll.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Prefab/OgreBulletDynamicsRagDoll.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Prefab/OgreBulletDynamicsRagDoll.h	(revision 1971)
@@ -0,0 +1,82 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+
+#ifndef _OGREBULLETCOLLISIONS_RagDoll_H
+#define _OGREBULLETCOLLISIONS_RagDoll_H
+
+
+#include "OgreBulletDynamicsPreRequisites.h"
+
+
+namespace OgreBulletDynamics
+{
+	// -------------------------------------------------------------------------
+	// basic CollisionWorld
+	class RagDoll 
+	{
+	public:
+		RagDoll (btDynamicsWorld* ownerWorld, 
+				const btVector3& positionOffset);
+
+		virtual	~RagDoll ();
+
+		// Make ragdoll  active.
+		void ragdollEnable(bool doEnable);
+		// is ragdoll active.
+		bool isRagdollEnabled();
+
+		// Make constraint between body part active.
+		void constraintEnable(bool value);
+		// are constraint between body part active ?
+		bool isConstraintEnabled();
+
+		// Make it collidable or not.
+		void collisionEnable(bool value);
+		// if shapes can collide
+		bool isCollisionEnabled();
+
+		// Make it fixed in a pose or not.
+		void rigidityEnable(bool value);
+		// is it fixed on a pose?
+		bool isRigidityEnable();
+
+
+	protected:
+		btDynamicsWorld* m_ownerWorld;
+
+		std::vector<btCollisionShape* >  m_shapes;
+		std::vector<btRigidBody* >		 m_bodies;
+		std::vector<btTypedConstraint* > m_joints;
+
+		btRigidBody* localCreateRigidBody (btScalar mass, 
+			const btTransform& startTransform, 
+			btCollisionShape* shape);
+
+	};
+}
+#endif //_OGREBULLETCOLLISIONS_CollisionWorld_H
+
Index: /code/branches/physics/src/ogrebullet/Revision.txt
===================================================================
--- /code/branches/physics/src/ogrebullet/Revision.txt	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Revision.txt	(revision 1971)
@@ -0,0 +1,3 @@
+This source code was taken from revision
+2493
+of the ogreaddons SVN repositories.
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsBoxShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsBoxShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsBoxShape.cpp	(revision 1971)
@@ -0,0 +1,49 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Utils/OgreBulletConverter.h"
+#include "Shapes/OgreBulletCollisionsBoxShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    BoxCollisionShape::BoxCollisionShape(const Vector3  &bodyBounds):	
+        CollisionShape()
+    {
+            mShape = new btBoxShape(OgreBtConverter::to(bodyBounds));
+    }
+    // -------------------------------------------------------------------------
+    BoxCollisionShape::~BoxCollisionShape()
+    {
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsBoxShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsBoxShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsBoxShape.h	(revision 1971)
@@ -0,0 +1,47 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_BoxShape_H
+#define _OGREBULLETCOLLISIONS_BoxShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic BoxShape
+    class BoxCollisionShape : public CollisionShape
+    {
+    public:
+        BoxCollisionShape(const Ogre::Vector3  &boxBounds);
+	    virtual ~BoxCollisionShape();
+
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_BoxShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCapsuleShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCapsuleShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCapsuleShape.cpp	(revision 1971)
@@ -0,0 +1,54 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+#include "Utils/OgreBulletConverter.h"
+
+#include "Shapes/OgreBulletCollisionsCapsuleShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    CapsuleCollisionShape::CapsuleCollisionShape(const Real  radius, const Real height, const Vector3 &axe):	
+        CollisionShape()
+    {
+        if (axe == Vector3::UNIT_X)
+            mShape = new btCapsuleShapeX(radius, height);
+        else if (axe == Vector3::UNIT_Y)
+            mShape = new btCapsuleShape (radius, height);
+        else if (axe == Vector3::UNIT_Z)
+            mShape = new btCapsuleShapeZ(radius, height);
+    }
+    // -------------------------------------------------------------------------
+    CapsuleCollisionShape::~CapsuleCollisionShape()
+    {
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCapsuleShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCapsuleShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCapsuleShape.h	(revision 1971)
@@ -0,0 +1,47 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_CapsuleShape_H
+#define _OGREBULLETCOLLISIONS_CapsuleShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic CapsuleShape
+    class CapsuleCollisionShape : public CollisionShape
+    {
+    public:
+        CapsuleCollisionShape(const Ogre::Real radius, const Ogre::Real height, const Ogre::Vector3 &axe);
+	    virtual ~CapsuleCollisionShape();
+
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_CapsuleShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCompoundShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCompoundShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCompoundShape.cpp	(revision 1971)
@@ -0,0 +1,93 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+#include "Utils/OgreBulletConverter.h"
+
+#include "Shapes/OgreBulletCollisionsCompoundShape.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    CompoundCollisionShape::CompoundCollisionShape():	
+        CollisionShape()
+    {
+            mShape = new btCompoundShape();
+    }
+    // -------------------------------------------------------------------------
+    CompoundCollisionShape::~CompoundCollisionShape()
+    {
+    }
+    // -------------------------------------------------------------------------
+    void CompoundCollisionShape::addChildShape(CollisionShape *shape, const Vector3 &pos, const Quaternion &quat)
+    {
+        btTransform localTrans;
+        
+        //localTrans.setIdentity();
+        //localTrans effectively shifts the center of mass with respect to the chassis
+        localTrans.setOrigin (OgreBtConverter::to(pos));
+        localTrans.setRotation (OgreBtConverter::to(quat));
+
+        static_cast <btCompoundShape *> (mShape)->addChildShape(localTrans, shape->getBulletShape());
+        
+        mShapes.push_back (shape);
+    }
+    // -------------------------------------------------------------------------
+    bool CompoundCollisionShape::drawWireFrame(DebugLines *wire, 
+        const Ogre::Vector3 &pos, 
+        const Ogre::Quaternion &quat) const
+    {
+        bool isVisual = false;
+        btCompoundShape * const myBtCompoundShape = static_cast <btCompoundShape *> (mShape);
+        int numChildShapes = myBtCompoundShape->getNumChildShapes ();
+
+        int i;
+        for (std::vector<CollisionShape *>::const_iterator itShape = mShapes.begin(); 
+            itShape != mShapes.end(); ++itShape)
+        {
+            const btCollisionShape * const shape = (*itShape)->getBulletShape();
+            for (i = 0; i < numChildShapes; i++)
+            {
+                if (myBtCompoundShape->getChildShape (i) == shape)
+                    break;
+            }
+            assert (i < numChildShapes);
+
+            const btTransform &localTrans = myBtCompoundShape->getChildTransform (i);
+
+            const Vector3 pos (BtOgreConverter::to(localTrans.getOrigin ()));
+            const Quaternion quat( BtOgreConverter::to(localTrans.getRotation ()));
+
+            if ((*itShape)->drawWireFrame(wire, pos, quat))
+                isVisual = true;
+        }
+        return isVisual;
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCompoundShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCompoundShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCompoundShape.h	(revision 1971)
@@ -0,0 +1,58 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_CompoundCollisionShape_H
+#define _OGREBULLETCOLLISIONS_CompoundCollisionShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic CompoundShape
+    class CompoundCollisionShape : public CollisionShape
+    {
+    public:
+        CompoundCollisionShape();
+	    virtual ~CompoundCollisionShape();
+
+        void addChildShape(CollisionShape *shape, 
+                            const Ogre::Vector3 &pos = Ogre::Vector3::ZERO, 
+                            const Ogre::Quaternion &quat = Ogre::Quaternion::IDENTITY);
+
+
+        bool drawWireFrame(DebugLines *wire, 
+            const Ogre::Vector3 &pos = Ogre::Vector3::ZERO, 
+            const Ogre::Quaternion &quat= Ogre::Quaternion::IDENTITY) const;
+
+    protected:
+        std::vector<CollisionShape *> mShapes;
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_CompoundCollisionShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConeShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConeShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConeShape.cpp	(revision 1971)
@@ -0,0 +1,54 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Shapes/OgreBulletCollisionsConeShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    ConeCollisionShape::ConeCollisionShape(Real radius, Real height, const Vector3 &axe):	
+        CollisionShape()
+    {
+        if (axe == Vector3::UNIT_Y)
+            mShape = new btConeShape (btScalar (radius), btScalar (height));
+        else if (axe == Vector3::UNIT_X)
+            mShape = new btConeShapeX (btScalar (radius), btScalar (height));
+        else
+             mShape = new btConeShapeZ (btScalar (radius), btScalar (height));
+
+    }
+    // -------------------------------------------------------------------------
+    ConeCollisionShape::~ConeCollisionShape ()
+    {
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConeShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConeShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConeShape.h	(revision 1971)
@@ -0,0 +1,47 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_ConeShape_H
+#define _OGREBULLETCOLLISIONS_ConeShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic ConeShape
+    class ConeCollisionShape : public CollisionShape
+    {
+    public:
+        ConeCollisionShape(Ogre::Real radius, Ogre::Real height, const Ogre::Vector3 &axe);
+	    virtual ~ConeCollisionShape();
+
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_ConeShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConvexHullShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConvexHullShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConvexHullShape.cpp	(revision 1971)
@@ -0,0 +1,55 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Shapes/OgreBulletCollisionsConvexHullShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    ConvexHullCollisionShape::ConvexHullCollisionShape(const Real* points, int numPoints, int stride):	
+        CollisionShape()
+    {
+            mShape = new btConvexHullShape((btScalar*) points, numPoints, stride);
+    }
+    // -------------------------------------------------------------------------
+    ConvexHullCollisionShape::ConvexHullCollisionShape():	
+    CollisionShape()
+    {
+        mShape = new btConvexHullShape();
+    }
+    // -------------------------------------------------------------------------
+    ConvexHullCollisionShape::~ConvexHullCollisionShape()
+    {
+    }
+
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConvexHullShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConvexHullShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsConvexHullShape.h	(revision 1971)
@@ -0,0 +1,49 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_ConvexHullShape_H
+#define _OGREBULLETCOLLISIONS_ConvexHullShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic ConvexHullShape
+    class ConvexHullCollisionShape : public CollisionShape
+    {
+    public:
+        ConvexHullCollisionShape(const Ogre::Real* points, int numPoints, int stride);
+        ConvexHullCollisionShape();
+
+	    virtual ~ConvexHullCollisionShape();
+
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_ConvexHullShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCylinderShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCylinderShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCylinderShape.cpp	(revision 1971)
@@ -0,0 +1,54 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+#include "Utils/OgreBulletConverter.h"
+
+#include "Shapes/OgreBulletCollisionsCylinderShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    CylinderCollisionShape::CylinderCollisionShape(const Vector3  &halfExtents, const Vector3 &axe):	
+        CollisionShape()
+    {
+        if (axe == Vector3::UNIT_X)
+            mShape = new btCylinderShapeX(OgreBtConverter::to(halfExtents));
+        else if (axe == Vector3::UNIT_Y)
+            mShape = new btCylinderShape (OgreBtConverter::to(halfExtents));
+        else if (axe == Vector3::UNIT_Z)
+            mShape = new btCylinderShapeZ(OgreBtConverter::to(halfExtents));
+    }
+    // -------------------------------------------------------------------------
+    CylinderCollisionShape::~CylinderCollisionShape()
+    {
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCylinderShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCylinderShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsCylinderShape.h	(revision 1971)
@@ -0,0 +1,47 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_CylinderShape_H
+#define _OGREBULLETCOLLISIONS_CylinderShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic CylinderShape
+    class CylinderCollisionShape : public CollisionShape
+    {
+    public:
+        CylinderCollisionShape(const Ogre::Vector3  &halfExtents, const Ogre::Vector3 &axe);
+	    virtual ~CylinderCollisionShape();
+
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_CylinderShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsGImpactShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsGImpactShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsGImpactShape.cpp	(revision 1971)
@@ -0,0 +1,166 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Shapes/OgreBulletCollisionsGImpactShape.h"
+
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "Shapes/OgreBulletCollisionsTrimeshShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+#include "Utils/OgreBulletConverter.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+	GImpactConcaveShape::GImpactConcaveShape(
+		Ogre::Vector3 *_vertices,
+		unsigned int _vertex_count,
+		unsigned int *_indices,
+		unsigned int int_index_count) : CollisionShape(), mTriMesh(0)
+	{
+		mTriMesh = new btTriangleMesh();
+
+		unsigned int numFaces = int_index_count / 3;
+
+		btVector3    vertexPos[3];
+		for (size_t n = 0; n < numFaces; ++n)
+		{
+			for (unsigned int i = 0; i < 3; ++i)
+			{
+				const Vector3 &vec = _vertices[*_indices];
+				vertexPos[i][0] = vec.x;
+				vertexPos[i][1] = vec.y;
+				vertexPos[i][2] = vec.z;
+				*_indices++;
+			}
+
+			mTriMesh->addTriangle(vertexPos[0], vertexPos[1], vertexPos[2]);
+		}
+
+		btGImpactMeshShape * trimesh = new btGImpactMeshShape(mTriMesh);
+		trimesh->setLocalScaling(btVector3(1, 1, 1));
+		trimesh->updateBound();
+		mShape = trimesh;
+	}
+
+	GImpactConcaveShape::~GImpactConcaveShape()
+	{
+	}
+	// -------------------------------------------------------------------------
+	bool GImpactConcaveShape::drawWireFrame(DebugLines *wire, 
+		const Ogre::Vector3 &pos, 
+		const Ogre::Quaternion &quat) const
+	{
+		const int numTris = mTriMesh->getNumTriangles ();
+		if (numTris > 0)
+		{
+
+			const int numSubParts = mTriMesh->getNumSubParts ();
+			for (int currSubPart = 0; currSubPart < numSubParts; currSubPart++)
+			{
+				const unsigned char* vertexBase = NULL;
+				int numVerts;
+				PHY_ScalarType vertexType;
+				int vertexStride;
+				const unsigned char* indexBase = NULL;
+				int indexStride;
+				int numFaces;
+				PHY_ScalarType indexType;
+
+				mTriMesh->getLockedReadOnlyVertexIndexBase (&vertexBase, numVerts, 
+					vertexType, vertexStride, 
+					&indexBase, indexStride, numFaces, indexType, currSubPart);
+
+				float* p;
+				btVector3 vert0;
+				btVector3 vert1;
+				btVector3 vert2;
+				for (int t = 0; t < numFaces; t++)
+				{
+#define setVector(A, B) {A.setX(B[0]);A.setY(B[1]);A.setZ(B[2]);};
+
+					if (indexType == PHY_SHORT)
+					{
+						short int* index = (short int*)(indexBase + t*indexStride);
+
+						p = (float*)(vertexBase + index[0]*vertexStride);
+						setVector(vert0, p);						
+						p = (float*)(vertexBase + index[1]*vertexStride);
+						setVector(vert1, p);			
+						p = (float*)(vertexBase + index[2]*vertexStride);
+						setVector(vert2, p);		
+					} 
+					else
+					{
+						int* index = (int*)(indexBase + t*indexStride);
+
+						p = (float*)(vertexBase + index[0]*vertexStride);
+						setVector(vert0, p);						
+						p = (float*)(vertexBase + index[1]*vertexStride);
+						setVector(vert1, p);			
+						p = (float*)(vertexBase + index[2]*vertexStride);
+						setVector(vert2, p);		
+					}
+#undef setVector
+
+					wire->addLine (BtOgreConverter::to(vert0), BtOgreConverter::to(vert1));
+					wire->addLine (BtOgreConverter::to(vert1), BtOgreConverter::to(vert2));
+					wire->addLine (BtOgreConverter::to(vert2), BtOgreConverter::to(vert0));
+				}
+			}
+			return true;
+		}
+		return false;
+	}
+}
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsGImpactShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsGImpactShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsGImpactShape.h	(revision 1971)
@@ -0,0 +1,56 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+#ifndef   _OGREBULLETCOLLISIONS_GImpact_Shapes_H
+#define   _OGREBULLETCOLLISIONS_GImpact_Shapes_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "BulletCollision/GIMPACT/btGImpactShape.h"
+#include "BulletCollision/GIMPACT/btGImpactCollisionAlgorithm.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+	class __declspec( dllexport ) GImpactConcaveShape : public CollisionShape
+#else
+	class GImpactConcaveShape : public CollisionShape
+#endif
+	{
+	public:
+		GImpactConcaveShape(Ogre::Vector3 *_vertices, unsigned int _vertex_count, unsigned int *_indices, unsigned int_index_count);
+		virtual ~GImpactConcaveShape();
+
+		bool drawWireFrame(DebugLines *wire, 
+			const Ogre::Vector3 &pos = Ogre::Vector3::ZERO, 
+			const Ogre::Quaternion &quat= Ogre::Quaternion::IDENTITY) const;
+
+	private:
+		btTriangleMesh*         mTriMesh;
+	};
+}
+#endif
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMinkowskiSumShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMinkowskiSumShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMinkowskiSumShape.cpp	(revision 1971)
@@ -0,0 +1,56 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Shapes/OgreBulletCollisionsMinkowskiSumShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+#include "BulletCollision/CollisionShapes/btMinkowskiSumShape.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    MinkowskiSumCollisionShape::MinkowskiSumCollisionShape(CollisionShape* shapeA, CollisionShape* shapeB) :	
+        CollisionShape()
+    {
+        //assert (shapeA->getBulletShape()->getClass() == CONVEX && 
+         //       shapeB->getBulletShape()->getClass() == CONVEX);
+
+        mShape = new btMinkowskiSumShape(
+            (btConvexShape*)shapeA->getBulletShape(),
+            (btConvexShape*)shapeB->getBulletShape()
+            );
+    }
+    // -------------------------------------------------------------------------
+    MinkowskiSumCollisionShape::~MinkowskiSumCollisionShape()
+    {
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMinkowskiSumShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMinkowskiSumShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMinkowskiSumShape.h	(revision 1971)
@@ -0,0 +1,47 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_MinkowskiSumShape_H
+#define _OGREBULLETCOLLISIONS_MinkowskiSumShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic MinkowskiSumShape
+    class MinkowskiSumCollisionShape : public CollisionShape
+    {
+    public:
+	    MinkowskiSumCollisionShape(CollisionShape* shapeA, CollisionShape* shapeB);
+	    virtual ~MinkowskiSumCollisionShape();
+
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_MinkowskiSumShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMultiSphereShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMultiSphereShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMultiSphereShape.cpp	(revision 1971)
@@ -0,0 +1,68 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Shapes/OgreBulletCollisionsMultiSphereShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+#include "Utils/OgreBulletConverter.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    MultiSphereCollisionShape::MultiSphereCollisionShape(
+        const Ogre::Vector3& inertiaHalfExtents,
+        const Ogre::Vector3* positions,
+        const Ogre::Real* radi,
+        int numSpheres):	
+        CollisionShape()
+    {
+		btVector3 * btPositions = new btVector3[numSpheres];
+		{
+			unsigned int currNum = numSpheres;
+			while (currNum-- > 0)
+			{
+				btPositions[currNum] = OgreBtConverter::to(positions[currNum]);
+			}
+		}
+
+        mShape = new btMultiSphereShape(
+            OgreBtConverter::to(inertiaHalfExtents),
+            (btVector3 *) btPositions,
+            (const btScalar *) radi,
+            numSpheres);
+
+		delete [] btPositions;
+    }
+    // -------------------------------------------------------------------------
+    MultiSphereCollisionShape::~MultiSphereCollisionShape()
+    {
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMultiSphereShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMultiSphereShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsMultiSphereShape.h	(revision 1971)
@@ -0,0 +1,51 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_MultiSphereShape_H
+#define _OGREBULLETCOLLISIONS_MultiSphereShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic MultiSphereShape
+    class MultiSphereCollisionShape : public CollisionShape
+    {
+    public:
+        MultiSphereCollisionShape(
+            const Ogre::Vector3& inertiaHalfExtents,
+            const Ogre::Vector3* positions,
+            const Ogre::Real* radi,
+            int numSpheres);
+	    virtual ~MultiSphereCollisionShape();
+
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_MultiSphereShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsSphereShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsSphereShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsSphereShape.cpp	(revision 1971)
@@ -0,0 +1,48 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Shapes/OgreBulletCollisionsSphereShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    SphereCollisionShape::SphereCollisionShape(const Real radius):	
+        CollisionShape()
+    {
+            mShape = new btSphereShape(radius);
+    }
+    // -------------------------------------------------------------------------
+    SphereCollisionShape::~SphereCollisionShape()
+    {
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsSphereShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsSphereShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsSphereShape.h	(revision 1971)
@@ -0,0 +1,48 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_SphereShape_H
+#define _OGREBULLETCOLLISIONS_SphereShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic SphereShape
+    class SphereCollisionShape : public CollisionShape
+    {
+    public:
+        SphereCollisionShape(const Ogre::Real  radius);
+	    virtual ~SphereCollisionShape();
+
+    private:
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_SphereShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsStaticPlaneShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsStaticPlaneShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsStaticPlaneShape.cpp	(revision 1971)
@@ -0,0 +1,56 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Shapes/OgreBulletCollisionsStaticPlaneShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    StaticPlaneCollisionShape::StaticPlaneCollisionShape(const Vector3 normal, Real distance):	
+        CollisionShape()
+    {
+            mShape = new btStaticPlaneShape (btVector3 (normal.x, normal.y, normal.z), btScalar (distance));
+    }
+    // -------------------------------------------------------------------------
+    StaticPlaneCollisionShape::~StaticPlaneCollisionShape()
+    {
+    }
+    // -------------------------------------------------------------------------
+    bool StaticPlaneCollisionShape::drawWireFrame(DebugLines *wire, 
+        const Ogre::Vector3 &pos, 
+        const Ogre::Quaternion &quat) const
+    {        
+        return false;
+    }
+
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsStaticPlaneShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsStaticPlaneShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsStaticPlaneShape.h	(revision 1971)
@@ -0,0 +1,50 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_StaticPlaneShape_H
+#define _OGREBULLETCOLLISIONS_StaticPlaneShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic BoxShape
+    class StaticPlaneCollisionShape : public CollisionShape
+    {
+    public:
+        StaticPlaneCollisionShape(const Ogre::Vector3 normal, Ogre::Real distance);
+	    virtual ~StaticPlaneCollisionShape();
+
+        bool drawWireFrame(DebugLines *wire, 
+            const Ogre::Vector3 &pos = Ogre::Vector3::ZERO, 
+            const Ogre::Quaternion &quat= Ogre::Quaternion::IDENTITY) const;
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_StaticPlaneShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTerrainShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTerrainShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTerrainShape.h	(revision 1971)
@@ -0,0 +1,131 @@
+#ifndef _OGREBULLET_HEIGHTMAP_
+#define _OGREBULLET_HEIGHTMAP_
+
+
+#include "OgreBulletCollisionsPrerequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+#include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h"
+#include "BulletCollision/CollisionShapes/btTriangleCallback.h"
+#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
+
+namespace OgreBulletCollisions
+{
+	
+	class DebugHelper : public btIDebugDraw
+	{
+	public:
+
+		DebugHelper(DebugLines* pLines) : m_pLines(pLines) {}
+		~DebugHelper () {}
+
+		void	drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
+		{
+			Ogre::Vector3 a(from.x(), from.y(), from.z());
+			Ogre::Vector3 b(to.x(), to.y(), to.z());
+			m_pLines->addLine(a, b);
+		}
+		void	draw3dText(const btVector3 &,const char *)
+		{
+
+		}
+
+		void	drawContactPoint(const btVector3& PointOnB,const btVector3& normalOnB,btScalar distance,int lifeTime,const btVector3& color)
+		{
+		}
+
+		void	reportErrorWarning(const char* warningString)
+		{
+		}
+
+		void	setDebugMode(int debugMode)
+		{
+		}
+
+		int		getDebugMode() const
+		{
+			return -1;
+		}
+
+	private:
+		DebugLines* m_pLines;
+	};
+
+	class DebugTriangleDrawCallback : public btTriangleCallback
+	{
+	private:
+
+		DebugHelper     *mDebugHelper;
+		btTransform     mTransform;
+		btVector3		mColor;
+
+	public:
+
+		DebugTriangleDrawCallback(DebugHelper *db, btTransform &bt, const btVector3& color) :
+		  btTriangleCallback(),
+			mDebugHelper(db),
+			mTransform(bt),
+			mColor(color)
+		{
+
+		}
+
+		void processTriangle(btVector3* triangle, int partId, int triangleIndex)
+		{
+			mDebugHelper->drawLine (*triangle,     *(triangle+1), mColor);
+			mDebugHelper->drawLine (*(triangle+1), *(triangle+2), mColor);
+			mDebugHelper->drawLine (*(triangle+2), *triangle,     mColor);
+		}						 
+	};
+
+	class HeightmapCollisionShape : public CollisionShape
+	{
+	public:
+		HeightmapCollisionShape(int width, int length, Ogre::Vector3& scale, Ogre::Real* pHeightData, bool bFlip)
+		{
+			int upIndex = 1;
+			bool useFloatDatam=true;
+			bool flipQuadEdges=bFlip;
+
+			btHeightfieldTerrainShape* pHeightShape = 
+				new btHeightfieldTerrainShape(width, length, pHeightData, scale.y, upIndex, useFloatDatam, flipQuadEdges);
+			pHeightShape->setUseDiamondSubdivision(true);
+
+			mShape = pHeightShape;
+
+			btVector3 sc(scale.x, scale.y, scale.z);
+			mShape->setLocalScaling(sc);
+
+		}
+
+		virtual ~HeightmapCollisionShape()
+		{
+		}
+
+		bool drawWireFrame(DebugLines *wire, 
+			const Ogre::Vector3 &pos = Ogre::Vector3::ZERO, 
+			const Ogre::Quaternion &quat= Ogre::Quaternion::IDENTITY) const
+		{
+			btHeightfieldTerrainShape* pHeightShape = static_cast<btHeightfieldTerrainShape*>(mShape);
+
+			btTransform bt;
+			bt.setIdentity();
+
+			btVector3 colour(255.0, 255.0, 255.0);
+
+			DebugHelper ddraw(wire);
+			DebugTriangleDrawCallback cb(&ddraw, bt, colour);
+
+			btVector3 aabbMax(btScalar(1e30),btScalar(1e30),btScalar(1e30));
+			btVector3 aabbMin(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30));
+			pHeightShape->processAllTriangles(&cb, aabbMin, aabbMax);
+			return true;
+		}
+
+	};
+}
+
+
+#endif // _OGREBULLET_HEIGHTMAP_
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTriangleShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTriangleShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTriangleShape.cpp	(revision 1971)
@@ -0,0 +1,67 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Shapes/OgreBulletCollisionsTriangleShape.h"
+
+#include "BulletCollision/CollisionShapes/btTriangleShape.h"
+#include "Utils/OgreBulletConverter.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    TriangleCollisionShape::TriangleCollisionShape(
+        const Ogre::Vector3 &p1, 
+        const Ogre::Vector3 &p2, 
+        const Ogre::Vector3 &p3):	
+        CollisionShape()
+    {
+            mShape = new btTriangleShape(OgreBtConverter::to(p1), 
+                                         OgreBtConverter::to(p2), 
+                                         OgreBtConverter::to(p3)); 
+    }
+    // -------------------------------------------------------------------------
+    TriangleCollisionShape::TriangleCollisionShape( 
+        Ogre::Real p1X, Ogre::Real p1Y, Ogre::Real p1Z, 
+        Ogre::Real p2X, Ogre::Real p2Y, Ogre::Real p2Z,  
+        Ogre::Real p3X, Ogre::Real p3Y, Ogre::Real p3Z):
+        CollisionShape()
+    {
+        mShape = new btTriangleShape(btVector3(p1X, p1Z, p1Z), 
+                                     btVector3(p2X, p2Y, p2Z), 
+                                     btVector3(p3X, p3Y, p3Z)); 
+    }
+    // -------------------------------------------------------------------------
+    TriangleCollisionShape::~TriangleCollisionShape()
+    {
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTriangleShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTriangleShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTriangleShape.h	(revision 1971)
@@ -0,0 +1,52 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_TriangleShape_H
+#define _OGREBULLETCOLLISIONS_TriangleShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic TriangleShape
+    class TriangleCollisionShape : public CollisionShape
+    {
+    public:
+        TriangleCollisionShape(const Ogre::Vector3 &p1, const Ogre::Vector3 &p2, const Ogre::Vector3 &p3);	
+        TriangleCollisionShape( 
+            Ogre::Real p1X, Ogre::Real p1Y, Ogre::Real p1Z, 
+            Ogre::Real p2X, Ogre::Real p2Y, Ogre::Real p2Z,  
+            Ogre::Real p3X, Ogre::Real p3Y, Ogre::Real p3Z);
+
+	    virtual ~TriangleCollisionShape();
+
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_TriangleShape_H
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTrimeshShape.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTrimeshShape.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTrimeshShape.cpp	(revision 1971)
@@ -0,0 +1,154 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Shapes/OgreBulletCollisionsTrimeshShape.h"
+#include "Debug/OgreBulletCollisionsDebugLines.h"
+#include "Utils/OgreBulletConverter.h"
+
+using namespace Ogre;
+using namespace OgreBulletCollisions;
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    TriangleMeshCollisionShape::TriangleMeshCollisionShape(
+        Vector3        *vertices, 
+        unsigned int vertexCount, 
+        unsigned int *indices, 
+        unsigned int indexCount,
+		bool use32bitsIndices) :	
+        CollisionShape(),
+        mTriMesh(0)
+    {
+		unsigned int numFaces = indexCount / 3;
+
+		mTriMesh = new btTriangleMesh(use32bitsIndices);
+
+        btVector3    vertexPos[3];
+        for (unsigned int n = 0; n < numFaces; ++n)
+        {
+			{
+				const Vector3 &vec = vertices[*indices];
+				vertexPos[0][0] = vec.x;
+				vertexPos[0][1] = vec.y;
+				vertexPos[0][2] = vec.z;
+			}
+			{
+				const Vector3 &vec = vertices[*(indices + 1)];
+				vertexPos[1][0] = vec.x;
+				vertexPos[1][1] = vec.y;
+				vertexPos[1][2] = vec.z;
+			}
+			{
+				const Vector3 &vec = vertices[*(indices + 2)];
+				vertexPos[2][0] = vec.x;
+				vertexPos[2][1] = vec.y;
+				vertexPos[2][2] = vec.z;
+			}
+
+			indices += 3;
+
+            mTriMesh->addTriangle(vertexPos[0], vertexPos[1], vertexPos[2]);
+        }
+
+		const bool useQuantizedAABB = true;
+        mShape = new btBvhTriangleMeshShape(mTriMesh, useQuantizedAABB);
+
+    }
+    // -------------------------------------------------------------------------
+    TriangleMeshCollisionShape::~TriangleMeshCollisionShape()
+    {
+    }
+    // -------------------------------------------------------------------------
+	bool TriangleMeshCollisionShape::drawWireFrame(DebugLines *wire, 
+		const Ogre::Vector3 &pos, 
+		const Ogre::Quaternion &quat) const
+    {
+        const int numTris = mTriMesh->getNumTriangles ();
+        if (numTris > 0)
+        {
+
+			const int numSubParts = mTriMesh->getNumSubParts ();
+			for (int currSubPart = 0; currSubPart < numSubParts; currSubPart++)
+			{
+				const unsigned char* vertexBase = NULL;
+				int numVerts;
+				PHY_ScalarType vertexType;
+				int vertexStride;
+				const unsigned char* indexBase = NULL;
+				int indexStride;
+				int numFaces;
+				PHY_ScalarType indexType;
+
+				mTriMesh->getLockedReadOnlyVertexIndexBase (&vertexBase, numVerts, 
+					vertexType, vertexStride, 
+					&indexBase, indexStride, numFaces, indexType, currSubPart);
+
+				float* p;
+				btVector3 vert0;
+				btVector3 vert1;
+				btVector3 vert2;
+				for (int t = 0; t < numFaces; t++)
+				{
+#define setVector(A, B) {A.setX(B[0]);A.setY(B[1]);A.setZ(B[2]);};
+
+					if (indexType == PHY_SHORT)
+					{
+						short int* index = (short int*)(indexBase + t*indexStride);
+
+						p = (float*)(vertexBase + index[0]*vertexStride);
+						setVector(vert0, p);						
+						p = (float*)(vertexBase + index[1]*vertexStride);
+						setVector(vert1, p);			
+						p = (float*)(vertexBase + index[2]*vertexStride);
+						setVector(vert2, p);		
+					} 
+					else
+					{
+						int* index = (int*)(indexBase + t*indexStride);
+
+						p = (float*)(vertexBase + index[0]*vertexStride);
+						setVector(vert0, p);						
+						p = (float*)(vertexBase + index[1]*vertexStride);
+						setVector(vert1, p);			
+						p = (float*)(vertexBase + index[2]*vertexStride);
+						setVector(vert2, p);		
+					}
+#undef setVector
+
+					wire->addLine (BtOgreConverter::to(vert0), BtOgreConverter::to(vert1));
+					wire->addLine (BtOgreConverter::to(vert1), BtOgreConverter::to(vert2));
+					wire->addLine (BtOgreConverter::to(vert2), BtOgreConverter::to(vert0));
+				}
+			}
+            return true;
+        }
+        return false;
+    }
+}
+
Index: /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTrimeshShape.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTrimeshShape.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Shapes/OgreBulletCollisionsTrimeshShape.h	(revision 1971)
@@ -0,0 +1,53 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _OGREBULLETCOLLISIONS_TrimeshShape_H
+#define _OGREBULLETCOLLISIONS_TrimeshShape_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreBulletCollisionsShape.h"
+
+namespace OgreBulletCollisions
+{
+    // -------------------------------------------------------------------------
+    // basic TrimeshShape
+    class TriangleMeshCollisionShape : public CollisionShape
+    {
+	public:
+		TriangleMeshCollisionShape(Ogre::Vector3 *_vertices, unsigned int _vertex_count, unsigned int *_indices, unsigned int_index_count, bool use32bitsIndices = true);
+	    virtual ~TriangleMeshCollisionShape();
+
+		bool drawWireFrame(DebugLines *wire, 
+			const Ogre::Vector3 &pos = Ogre::Vector3::ZERO, 
+			const Ogre::Quaternion &quat= Ogre::Quaternion::IDENTITY) const;
+
+    private:
+        btTriangleMesh*         mTriMesh;
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_TrimeshShape_H
+
Index: /code/branches/physics/src/ogrebullet/Utils/OgreBulletCollisionsMeshToShapeConverter.cpp
===================================================================
--- /code/branches/physics/src/ogrebullet/Utils/OgreBulletCollisionsMeshToShapeConverter.cpp	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Utils/OgreBulletCollisionsMeshToShapeConverter.cpp	(revision 1971)
@@ -0,0 +1,782 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+
+#include "OgreBulletCollisions.h"
+
+#include "Utils/OgreBulletCollisionsMeshToShapeConverter.h"
+
+#include "Shapes/OgreBulletCollisionsTrimeshShape.h"
+#include "Shapes/OgreBulletCollisionsCylinderShape.h"
+#include "Shapes/OgreBulletCollisionsSphereShape.h"
+#include "Shapes/OgreBulletCollisionsBoxShape.h"
+#include "Shapes/OgreBulletCollisionsConvexHullShape.h"
+#include "Shapes/OgreBulletCollisionsCapsuleShape.h"
+
+using namespace OgreBulletCollisions;
+using namespace Ogre;
+
+//------------------------------------------------------------------------------------------------
+void VertexIndexToShape::addStaticVertexData(const VertexData *vertex_data)
+{
+	if (!vertex_data) 
+        return;
+
+	const VertexData *data = vertex_data;
+
+	const unsigned int prev_size = mVertexCount;
+    mVertexCount += (unsigned int)data->vertexCount;
+
+    Ogre::Vector3* tmp_vert = new Ogre::Vector3[mVertexCount];
+	if (mVertexBuffer)
+	{
+		memcpy(tmp_vert, mVertexBuffer, sizeof(Vector3) * prev_size);
+		delete[] mVertexBuffer;
+	}
+	mVertexBuffer = tmp_vert;
+
+	// Get the positional buffer element
+    {	
+        const Ogre::VertexElement* posElem = data->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);			
+        Ogre::HardwareVertexBufferSharedPtr vbuf = data->vertexBufferBinding->getBuffer(posElem->getSource());
+        const unsigned int vSize = (unsigned int)vbuf->getVertexSize();
+
+	    unsigned char* vertex = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
+	    float* pReal;
+        Ogre::Vector3 * curVertices = &mVertexBuffer[prev_size];
+        const unsigned int vertexCount = (unsigned int)data->vertexCount;
+	    for(unsigned int j = 0; j < vertexCount; ++j)
+	    {
+		    posElem->baseVertexPointerToElement(vertex, &pReal);
+            vertex += vSize;
+
+		    curVertices->x = (*pReal++);
+		    curVertices->y = (*pReal++);
+		    curVertices->z = (*pReal++);
+
+		    *curVertices = mTransform * (*curVertices);
+            
+            curVertices++;
+        }
+	    vbuf->unlock();
+    }
+}
+
+//------------------------------------------------------------------------------------------------
+void VertexIndexToShape::addAnimatedVertexData(const Ogre::VertexData *vertex_data,
+											   const Ogre::VertexData *blend_data,
+											   const Ogre::Mesh::IndexMap *indexMap)
+{	
+	// Get the bone index element
+	assert(vertex_data);
+
+	const VertexData *data = blend_data;
+	const unsigned int prev_size = mVertexCount;
+	mVertexCount += (unsigned int)data->vertexCount;
+	Ogre::Vector3* tmp_vert = new Ogre::Vector3[mVertexCount];
+	if (mVertexBuffer)
+	{
+		memcpy(tmp_vert, mVertexBuffer, sizeof(Vector3) * prev_size);
+		delete[] mVertexBuffer;
+	}
+	mVertexBuffer = tmp_vert;
+
+	// Get the positional buffer element
+	{	
+		const Ogre::VertexElement* posElem = data->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);	
+		assert (posElem);
+		Ogre::HardwareVertexBufferSharedPtr vbuf = data->vertexBufferBinding->getBuffer(posElem->getSource());
+		const unsigned int vSize = (unsigned int)vbuf->getVertexSize();
+
+		unsigned char* vertex = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
+		float* pReal;
+		Ogre::Vector3 * curVertices = &mVertexBuffer[prev_size];
+		const unsigned int vertexCount = (unsigned int)data->vertexCount;
+		for(unsigned int j = 0; j < vertexCount; ++j)
+		{
+			posElem->baseVertexPointerToElement(vertex, &pReal);
+			vertex += vSize;
+
+			curVertices->x = (*pReal++);
+			curVertices->y = (*pReal++);
+			curVertices->z = (*pReal++);
+
+			*curVertices = mTransform * (*curVertices);
+
+			curVertices++;
+		}
+		vbuf->unlock();
+	}
+	{
+		const Ogre::VertexElement* bneElem = vertex_data->vertexDeclaration->findElementBySemantic(Ogre::VES_BLEND_INDICES);
+		assert (bneElem);
+		
+		Ogre::HardwareVertexBufferSharedPtr vbuf = vertex_data->vertexBufferBinding->getBuffer(bneElem->getSource());
+		const unsigned int vSize = (unsigned int)vbuf->getVertexSize();
+		unsigned char* vertex = static_cast<unsigned char*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
+
+		unsigned char* pBone;
+
+		if (!mBoneIndex)
+			mBoneIndex = new BoneIndex();	
+		BoneIndex::iterator i;
+
+		Ogre::Vector3 * curVertices = &mVertexBuffer[prev_size];
+
+		const unsigned int vertexCount = (unsigned int)vertex_data->vertexCount;
+		for(unsigned int j = 0; j < vertexCount; ++j)
+		{
+			bneElem->baseVertexPointerToElement(vertex, &pBone);
+			vertex += vSize;
+
+			const unsigned char currBone = (indexMap) ? (*indexMap)[*pBone] : *pBone;
+			i = mBoneIndex->find (currBone);
+			Vector3Array* l = 0;
+			if (i == mBoneIndex->end())
+			{
+				l = new Vector3Array;
+				mBoneIndex->insert(BoneKeyIndex(currBone, l));
+			}						
+			else 
+			{
+				l = i->second;
+			}
+
+			l->push_back(*curVertices);
+
+			curVertices++;
+		}
+		vbuf->unlock();	
+	}
+}
+
+//------------------------------------------------------------------------------------------------
+void VertexIndexToShape::addIndexData(IndexData *data, const unsigned int offset)
+{
+    const unsigned int prev_size = mIndexCount;
+    mIndexCount += (unsigned int)data->indexCount;
+
+	unsigned int* tmp_ind = new unsigned int[mIndexCount];
+	if (mIndexBuffer)
+	{
+		memcpy (tmp_ind, mIndexBuffer, sizeof(unsigned int) * prev_size);
+		delete[] mIndexBuffer;
+	}
+	mIndexBuffer = tmp_ind;
+
+	const unsigned int numTris = (unsigned int) data->indexCount / 3;
+	HardwareIndexBufferSharedPtr ibuf = data->indexBuffer;	
+	const bool use32bitindexes = (ibuf->getType() == HardwareIndexBuffer::IT_32BIT);
+    unsigned int index_offset = prev_size;
+
+	if (use32bitindexes) 
+    {
+        const unsigned int* pInt = static_cast<unsigned int*>(ibuf->lock(HardwareBuffer::HBL_READ_ONLY));
+        for(unsigned int k = 0; k < numTris; ++k)
+        {
+            mIndexBuffer[index_offset ++] = offset + *pInt++;
+            mIndexBuffer[index_offset ++] = offset + *pInt++;
+            mIndexBuffer[index_offset ++] = offset + *pInt++;
+        }
+        ibuf->unlock();
+    }
+	else 
+    {
+        const unsigned short* pShort = static_cast<unsigned short*>(ibuf->lock(HardwareBuffer::HBL_READ_ONLY));
+		for(unsigned int k = 0; k < numTris; ++k)
+        {
+            mIndexBuffer[index_offset ++] = offset + static_cast<unsigned int> (*pShort++);
+            mIndexBuffer[index_offset ++] = offset + static_cast<unsigned int> (*pShort++);
+            mIndexBuffer[index_offset ++] = offset + static_cast<unsigned int> (*pShort++);
+        }
+        ibuf->unlock();
+    }
+
+}
+//------------------------------------------------------------------------------------------------
+Real VertexIndexToShape::getRadius()
+{
+	if (mBoundRadius == (-1))
+	{
+		getSize();
+		mBoundRadius = (std::max(mBounds.x,std::max(mBounds.y,mBounds.z)) * 0.5);
+	}
+	return mBoundRadius;
+}
+//------------------------------------------------------------------------------------------------
+Vector3 VertexIndexToShape::getSize()
+{
+    const unsigned int vCount = getVertexCount();
+	if (mBounds == Ogre::Vector3(-1,-1,-1) && vCount > 0)
+	{
+
+		const Ogre::Vector3 * const v = getVertices();
+
+        Ogre::Vector3 vmin(v[0]);
+        Ogre::Vector3 vmax(v[0]);
+
+		for(unsigned int j = 1; j < vCount; j++)
+		{
+			vmin.x = std::min(vmin.x, v[j].x);
+			vmin.y = std::min(vmin.y, v[j].y);
+			vmin.z = std::min(vmin.z, v[j].z);
+
+			vmax.x = std::max(vmax.x, v[j].x);
+			vmax.y = std::max(vmax.y, v[j].y);
+			vmax.z = std::max(vmax.z, v[j].z);
+		}
+
+		mBounds.x = vmax.x - vmin.x;
+		mBounds.y = vmax.y - vmin.y;
+		mBounds.z = vmax.z - vmin.z;
+	}
+
+	return mBounds;
+}
+//------------------------------------------------------------------------------------------------
+const Ogre::Vector3* VertexIndexToShape::getVertices()
+{
+	return mVertexBuffer;
+}
+//------------------------------------------------------------------------------------------------
+unsigned int VertexIndexToShape::getVertexCount()
+{
+	return mVertexCount;
+}
+//------------------------------------------------------------------------------------------------
+const unsigned int* VertexIndexToShape::getIndices()
+{
+	return mIndexBuffer;
+}
+//------------------------------------------------------------------------------------------------
+unsigned int VertexIndexToShape::getIndexCount()
+{
+	return mIndexCount;
+}
+
+//------------------------------------------------------------------------------------------------
+SphereCollisionShape* VertexIndexToShape::createSphere()
+{
+	const Ogre::Real rad = getRadius();
+	assert((rad > 0.0) && 
+        ("Sphere radius must be greater than zero"));
+    SphereCollisionShape* shape = new SphereCollisionShape(rad);
+
+    return shape;
+}
+//------------------------------------------------------------------------------------------------
+BoxCollisionShape* VertexIndexToShape::createBox()
+{
+	const Ogre::Vector3 sz = getSize();
+
+	assert((sz.x > 0.0) && (sz.y > 0.0) && (sz.y > 0.0) && 
+        ("Size of box must be greater than zero on all axes"));
+
+	BoxCollisionShape* shape = new BoxCollisionShape(sz);
+	return shape;
+}
+//------------------------------------------------------------------------------------------------
+CylinderCollisionShape* VertexIndexToShape::createCylinder()
+{
+    const Ogre::Vector3 sz = getSize();
+
+    assert((sz.x > 0.0) && (sz.y > 0.0) && (sz.y > 0.0) && 
+        ("Size of Cylinder must be greater than zero on all axes"));
+
+    CylinderCollisionShape* shape = new CylinderCollisionShape(sz, Vector3::UNIT_X);
+    return shape;
+}
+//------------------------------------------------------------------------------------------------
+ConvexHullCollisionShape* VertexIndexToShape::createConvex()
+{
+    assert(mVertexCount && (mIndexCount >= 6) && 
+        ("Mesh must have some vertices and at least 6 indices (2 triangles)"));
+
+    return new ConvexHullCollisionShape(&mVertexBuffer[0].x, mVertexCount, sizeof(Vector3));
+}
+//------------------------------------------------------------------------------------------------
+TriangleMeshCollisionShape* VertexIndexToShape::createTrimesh()
+{
+	assert(mVertexCount && (mIndexCount >= 6) && 
+        ("Mesh must have some vertices and at least 6 indices (2 triangles)"));
+
+	return new TriangleMeshCollisionShape(mVertexBuffer, mVertexCount,mIndexBuffer, mIndexCount);
+}
+//------------------------------------------------------------------------------------------------
+VertexIndexToShape::~VertexIndexToShape()
+{
+	delete[] mVertexBuffer;
+	delete[] mIndexBuffer;
+
+	if (mBoneIndex)
+	{
+		for(BoneIndex::iterator i = mBoneIndex->begin();
+            i != mBoneIndex->end();
+            ++i)
+		{
+			delete i->second;
+		}
+		delete mBoneIndex;
+	}
+}
+//------------------------------------------------------------------------------------------------
+VertexIndexToShape::VertexIndexToShape(const Matrix4 &transform) :
+	mVertexBuffer (0),
+	mIndexBuffer (0),
+	mVertexCount (0),
+	mIndexCount (0),
+	mBounds (Vector3(-1,-1,-1)),
+	mBoundRadius (-1),
+	mBoneIndex (0),
+	mTransform (transform)
+{	
+}
+//------------------------------------------------------------------------------------------------
+StaticMeshToShapeConverter::StaticMeshToShapeConverter() :
+VertexIndexToShape(),
+	mEntity (0),
+	mNode (0)
+{
+}
+//------------------------------------------------------------------------------------------------
+StaticMeshToShapeConverter::~StaticMeshToShapeConverter()
+{
+}
+//------------------------------------------------------------------------------------------------
+StaticMeshToShapeConverter::StaticMeshToShapeConverter(Entity *entity,  const Matrix4 &transform) :
+	VertexIndexToShape(transform),
+	mEntity (0),
+	mNode (0)
+{
+	addEntity(entity, transform);	
+}
+//------------------------------------------------------------------------------------------------
+StaticMeshToShapeConverter::StaticMeshToShapeConverter(Renderable *rend, const Matrix4 &transform) :
+	VertexIndexToShape(transform),
+	mEntity (0),
+	mNode (0)
+{
+	RenderOperation op;
+	rend->getRenderOperation(op);
+	VertexIndexToShape::addStaticVertexData(op.vertexData);
+	if(op.useIndexes)
+		VertexIndexToShape::addIndexData(op.indexData);
+
+}
+//------------------------------------------------------------------------------------------------
+void StaticMeshToShapeConverter::addEntity(Entity *entity,const Matrix4 &transform)
+{
+	// Each entity added need to reset size and radius
+	// next time getRadius and getSize are asked, they're computed.
+	mBounds  = Ogre::Vector3(-1,-1,-1);
+	mBoundRadius = -1;
+
+	mEntity = entity;
+	mNode = (SceneNode*)(mEntity->getParentNode());
+	mTransform = transform;
+
+	if (mEntity->getMesh()->sharedVertexData)
+	{
+		VertexIndexToShape::addStaticVertexData (mEntity->getMesh()->sharedVertexData);
+	}
+
+	for (unsigned int i = 0;i < mEntity->getNumSubEntities();++i)
+	{
+		SubMesh *sub_mesh = mEntity->getSubEntity(i)->getSubMesh();
+
+		if (!sub_mesh->useSharedVertices)
+		{
+			VertexIndexToShape::addIndexData(sub_mesh->indexData, mVertexCount);
+			VertexIndexToShape::addStaticVertexData (sub_mesh->vertexData);
+		}
+		else 
+		{
+			VertexIndexToShape::addIndexData (sub_mesh->indexData);
+		}
+
+	}
+}
+//------------------------------------------------------------------------------------------------
+void StaticMeshToShapeConverter::addMesh(const MeshPtr &mesh, const Matrix4 &transform)
+{
+	// Each entity added need to reset size and radius
+	// next time getRadius and getSize are asked, they're computed.
+	mBounds  = Ogre::Vector3(-1,-1,-1);
+	mBoundRadius = -1;
+
+	//_entity = entity;
+	//_node = (SceneNode*)(_entity->getParentNode());
+	mTransform = transform;
+
+	if (mesh->hasSkeleton ())
+		Ogre::LogManager::getSingleton().logMessage("MeshToShapeConverter::addMesh : Mesh " + mesh->getName () + " as skeleton but added to trimesh non animated");
+
+	if (mesh->sharedVertexData)
+	{
+		VertexIndexToShape::addStaticVertexData (mesh->sharedVertexData);
+	}
+
+	for(unsigned int i = 0;i < mesh->getNumSubMeshes();++i)
+	{
+		SubMesh *sub_mesh = mesh->getSubMesh(i);
+
+		if (!sub_mesh->useSharedVertices)
+		{
+			VertexIndexToShape::addIndexData(sub_mesh->indexData, mVertexCount);
+			VertexIndexToShape::addStaticVertexData (sub_mesh->vertexData);
+		}
+		else 
+		{
+			VertexIndexToShape::addIndexData (sub_mesh->indexData);
+		}
+
+	}
+}
+//------------------------------------------------------------------------------------------------
+AnimatedMeshToShapeConverter::AnimatedMeshToShapeConverter(Entity *entity,const Matrix4 &transform) :
+VertexIndexToShape(transform),
+mEntity (0),
+mNode (0),
+mTransformedVerticesTemp(0),
+mTransformedVerticesTempSize(0)
+{
+	addEntity(entity, transform);	
+}
+//------------------------------------------------------------------------------------------------
+AnimatedMeshToShapeConverter::AnimatedMeshToShapeConverter() :
+VertexIndexToShape(),
+mEntity (0),
+mNode (0),
+mTransformedVerticesTemp(0),
+mTransformedVerticesTempSize(0)
+{
+}
+//------------------------------------------------------------------------------------------------
+AnimatedMeshToShapeConverter::~AnimatedMeshToShapeConverter()
+{
+	delete[] mTransformedVerticesTemp;
+}
+//------------------------------------------------------------------------------------------------
+void AnimatedMeshToShapeConverter::addEntity(Entity *entity,const Matrix4 &transform)
+{
+	// Each entity added need to reset size and radius
+	// next time getRadius and getSize are asked, they're computed.
+	mBounds  = Ogre::Vector3(-1,-1,-1);
+	mBoundRadius = -1;
+
+	mEntity = entity;
+	mNode = (SceneNode*)(mEntity->getParentNode());
+	mTransform = transform;
+
+	assert (entity->getMesh()->hasSkeleton ());
+
+	mEntity->addSoftwareAnimationRequest(false);
+	mEntity->_updateAnimation();
+
+	if (mEntity->getMesh()->sharedVertexData)
+	{
+		VertexIndexToShape::addAnimatedVertexData (mEntity->getMesh()->sharedVertexData, 
+			mEntity->_getSkelAnimVertexData(),
+			&mEntity->getMesh()->sharedBlendIndexToBoneIndexMap); 
+	}
+
+	for (unsigned int i = 0;i < mEntity->getNumSubEntities();++i)
+	{
+		SubMesh *sub_mesh = mEntity->getSubEntity(i)->getSubMesh();
+
+		if (!sub_mesh->useSharedVertices)
+		{
+			VertexIndexToShape::addIndexData(sub_mesh->indexData, mVertexCount);
+
+			VertexIndexToShape::addAnimatedVertexData (sub_mesh->vertexData, 
+				mEntity->getSubEntity(i)->_getSkelAnimVertexData(),
+				&sub_mesh->blendIndexToBoneIndexMap); 
+		}
+		else 
+		{
+			VertexIndexToShape::addIndexData (sub_mesh->indexData);
+		}
+
+	}
+
+	mEntity->removeSoftwareAnimationRequest(false);
+}
+//------------------------------------------------------------------------------------------------
+void AnimatedMeshToShapeConverter::addMesh(const MeshPtr &mesh, const Matrix4 &transform)
+{
+	// Each entity added need to reset size and radius
+	// next time getRadius and getSize are asked, they're computed.
+	mBounds  = Ogre::Vector3(-1,-1,-1);
+	mBoundRadius = -1;
+
+	//_entity = entity;
+	//_node = (SceneNode*)(_entity->getParentNode());
+	mTransform = transform;
+
+	assert (mesh->hasSkeleton ());
+
+	if (mesh->sharedVertexData)
+	{
+		VertexIndexToShape::addAnimatedVertexData (mesh->sharedVertexData, 
+			0,
+			&mesh->sharedBlendIndexToBoneIndexMap); 
+	}
+
+	for(unsigned int i = 0;i < mesh->getNumSubMeshes();++i)
+	{
+		SubMesh *sub_mesh = mesh->getSubMesh(i);
+
+		if (!sub_mesh->useSharedVertices)
+		{
+			VertexIndexToShape::addIndexData(sub_mesh->indexData, mVertexCount);
+
+			VertexIndexToShape::addAnimatedVertexData (sub_mesh->vertexData, 
+				0,
+				&sub_mesh->blendIndexToBoneIndexMap); 
+		}
+		else 
+		{
+			VertexIndexToShape::addIndexData (sub_mesh->indexData);
+		}
+
+	}
+}
+//------------------------------------------------------------------------------------------------
+bool AnimatedMeshToShapeConverter::getBoneVertices(unsigned char bone, 
+													 unsigned int &vertex_count, 
+													 Ogre::Vector3* &vertices,
+													 const Vector3 &bonePosition)
+{
+	BoneIndex::iterator i = mBoneIndex->find(bone);
+
+	if (i == mBoneIndex->end()) 
+		return false;
+
+	if (i->second->empty()) 
+		return false;
+
+	vertex_count = (unsigned int) i->second->size() + 1;
+	if (vertex_count > mTransformedVerticesTempSize)
+	{	
+		if (mTransformedVerticesTemp)
+			delete[] mTransformedVerticesTemp;
+
+		mTransformedVerticesTemp = new Ogre::Vector3[vertex_count];
+
+	}
+
+	vertices = mTransformedVerticesTemp;
+	vertices[0] = bonePosition;
+	//mEntity->_getParentNodeFullTransform() * 
+	//	mEntity->getSkeleton()->getBone(bone)->_getDerivedPosition();
+
+	//mEntity->getSkeleton()->getBone(bone)->_getDerivedOrientation()
+	unsigned int currBoneVertex = 1;
+	Vector3Array::iterator j = i->second->begin();
+	while(j != i->second->end())
+	{
+		vertices[currBoneVertex] = (*j);
+		++j;
+		++currBoneVertex; 
+	}       
+	return true;
+}
+//------------------------------------------------------------------------------------------------
+BoxCollisionShape* AnimatedMeshToShapeConverter::createAlignedBox(unsigned char bone, 
+																  const Vector3 &bonePosition,
+																  const Quaternion &boneOrientation)
+{
+	unsigned int vertex_count;
+	Vector3* vertices;
+
+	if (!getBoneVertices(bone, vertex_count, vertices, bonePosition)) 
+		return 0;
+
+	Vector3 min_vec(vertices[0]);
+	Vector3 max_vec(vertices[0]);
+
+	for(unsigned int j = 1; j < vertex_count ;j++)
+	{
+		min_vec.x = std::min(min_vec.x,vertices[j].x);
+		min_vec.y = std::min(min_vec.y,vertices[j].y);
+		min_vec.z = std::min(min_vec.z,vertices[j].z);
+
+		max_vec.x = std::max(max_vec.x,vertices[j].x);
+		max_vec.y = std::max(max_vec.y,vertices[j].y);
+		max_vec.z = std::max(max_vec.z,vertices[j].z);
+	}
+	const Ogre::Vector3 maxMinusMin(max_vec - min_vec);
+	BoxCollisionShape* box = new BoxCollisionShape(maxMinusMin);
+
+	const Ogre::Vector3 pos
+		(min_vec.x + (maxMinusMin.x * 0.5),
+		min_vec.y + (maxMinusMin.y * 0.5),
+		min_vec.z + (maxMinusMin.z * 0.5));
+
+	//box->setPosition(pos);
+
+	return box;
+}
+//------------------------------------------------------------------------------------------------
+bool AnimatedMeshToShapeConverter::getOrientedBox(unsigned char bone, 
+					 const Vector3 &bonePosition,
+					 const Quaternion &boneOrientation,
+					 Vector3 &box_afExtent,
+					 Vector3 *box_akAxis,
+					 Vector3 &box_kCenter)
+{
+	unsigned int vertex_count;
+	Vector3* vertices;
+
+	if (!getBoneVertices(bone, vertex_count, vertices, bonePosition))
+		return false;
+
+	 box_kCenter = Vector3::ZERO;
+
+	 {
+		 for(unsigned int c = 0 ;c < vertex_count;c++)
+		 {
+			 box_kCenter += vertices[c];
+		 }
+		 const Ogre::Real invVertexCount = 1.0 / vertex_count;
+		 box_kCenter *= invVertexCount;
+	 }
+	Quaternion orient = boneOrientation;
+	orient.ToAxes(box_akAxis);
+
+
+	// Let C be the box center and let U0, U1, and U2 be the box axes.  Each
+	// input point is of the form X = C + y0*U0 + y1*U1 + y2*U2.  The
+	// following code computes min(y0), max(y0), min(y1), max(y1), min(y2),
+	// and max(y2).  The box center is then adjusted to be
+	//   C' = C + 0.5*(min(y0)+max(y0))*U0 + 0.5*(min(y1)+max(y1))*U1 +
+	//        0.5*(min(y2)+max(y2))*U2
+
+	Ogre::Vector3 kDiff (vertices[1] - box_kCenter);
+	Ogre::Real fY0Min = kDiff.dotProduct(box_akAxis[0]), fY0Max = fY0Min;
+	Ogre::Real fY1Min = kDiff.dotProduct(box_akAxis[1]), fY1Max = fY1Min;
+	Ogre::Real fY2Min = kDiff.dotProduct(box_akAxis[2]), fY2Max = fY2Min;
+
+	for (unsigned int i = 2; i < vertex_count; i++)
+	{
+		kDiff = vertices[i] - box_kCenter;
+
+		const Ogre::Real fY0 = kDiff.dotProduct(box_akAxis[0]);
+		if ( fY0 < fY0Min )
+			fY0Min = fY0;
+		else if ( fY0 > fY0Max )
+			fY0Max = fY0;
+
+		const Ogre::Real fY1 = kDiff.dotProduct(box_akAxis[1]);
+		if ( fY1 < fY1Min )
+			fY1Min = fY1;
+		else if ( fY1 > fY1Max )
+			fY1Max = fY1;
+
+		const Ogre::Real fY2 = kDiff.dotProduct(box_akAxis[2]);
+		if ( fY2 < fY2Min )
+			fY2Min = fY2;
+		else if ( fY2 > fY2Max )
+			fY2Max = fY2;
+	}
+
+	box_afExtent.x = ((Real)0.5)*(fY0Max - fY0Min);
+	box_afExtent.y = ((Real)0.5)*(fY1Max - fY1Min);
+	box_afExtent.z = ((Real)0.5)*(fY2Max - fY2Min);
+
+	box_kCenter += (0.5*(fY0Max+fY0Min))*box_akAxis[0] +
+		(0.5*(fY1Max+fY1Min))*box_akAxis[1] +
+		(0.5*(fY2Max+fY2Min))*box_akAxis[2];
+
+	box_afExtent *= 2.0;
+
+	return true;
+}
+//------------------------------------------------------------------------------------------------
+BoxCollisionShape* AnimatedMeshToShapeConverter::createOrientedBox(unsigned char bone, 
+																   const Vector3 &bonePosition,
+																   const Quaternion &boneOrientation)
+{
+	Ogre::Vector3 box_akAxis[3];
+	Ogre::Vector3 box_afExtent;
+	Ogre::Vector3 box_afCenter;
+
+	if (!getOrientedBox(bone, bonePosition, boneOrientation,
+						box_afExtent,
+						box_akAxis,
+						box_afCenter))
+		return 0;
+
+	BoxCollisionShape *geom = new BoxCollisionShape(box_afExtent);
+	//geom->setOrientation(Quaternion(box_akAxis[0],box_akAxis[1],box_akAxis[2]));
+	//geom->setPosition(box_afCenter);
+	return geom; 
+}
+//------------------------------------------------------------------------------------------------
+CapsuleCollisionShape* AnimatedMeshToShapeConverter::createOrientedCapsuleCollisionShape(unsigned char bone, 
+																							 const Vector3 &bonePosition,
+																							 const Quaternion &boneOrientation)
+{
+	Ogre::Vector3 box_akAxis[3];
+	Ogre::Vector3 box_afExtent;
+	Ogre::Vector3 box_afCenter;
+
+	if (!getOrientedBox(bone,  bonePosition, boneOrientation,
+						box_afExtent,
+						box_akAxis,
+						box_afCenter))
+		return 0;
+
+	// find axes with longest length
+
+	Vector3 cap_dir;    //std::max(box_afExtent.x,std::max(box_afExtent.y,box_afExtent.z));
+	Real cap_dirLength;  //std::max(box_afExtent.x,std::max(box_afExtent.y,box_afExtent.z));
+	Real cap_radius;	 // max axe length
+	if (box_afExtent.x - box_afExtent.y > 0 && box_afExtent.x - box_afExtent.z > 0)
+	{
+		cap_dir = Vector3::UNIT_X;
+		cap_dirLength = box_afExtent.x;
+		cap_radius = std::max (box_afExtent.y, box_afExtent.z);
+	}
+	else if (box_afExtent.y - box_afExtent.x > 0 && box_afExtent.y - box_afExtent.z > 0)
+	{
+		cap_dir = Vector3::UNIT_Y;
+		cap_dirLength = box_afExtent.y;
+		cap_radius = std::max (box_afExtent.x, box_afExtent.z);
+	}
+	else if (box_afExtent.z - box_afExtent.y > 0 && box_afExtent.z - box_afExtent.y > 0)
+	{
+		cap_dir = Vector3::UNIT_Z;
+		cap_dirLength = box_afExtent.z;
+		cap_radius = std::max (box_afExtent.x, box_afExtent.z);
+	}
+
+	CapsuleCollisionShape* geom = new CapsuleCollisionShape(cap_radius, cap_dirLength, cap_dir);
+
+	//geom->setOrientation(orient);
+	//geom->setPosition(cap_orig + (boneOrientation * (cap_dirLength * 0.5)));
+
+	return geom;
+}
Index: /code/branches/physics/src/ogrebullet/Utils/OgreBulletCollisionsMeshToShapeConverter.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Utils/OgreBulletCollisionsMeshToShapeConverter.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Utils/OgreBulletCollisionsMeshToShapeConverter.h	(revision 1971)
@@ -0,0 +1,155 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com (Use it Freely, even Statically, but have to contribute any changes)
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GPL General Public License with runtime exception 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 GPL General Public License with runtime exception for more details.
+
+You should have received a copy of the GPL General Public License with runtime exception along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+-----------------------------------------------------------------------------
+*/
+#ifndef _OgreBulletCollisionsMeshToShapeConverter_H_
+#define _OgreBulletCollisionsMeshToShapeConverter_H_
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+namespace OgreBulletCollisions 
+{
+	class VertexIndexToShape
+	{
+	public:
+		VertexIndexToShape(const Ogre::Matrix4 &transform = Ogre::Matrix4::IDENTITY);
+		~VertexIndexToShape();
+
+		Ogre::Real      getRadius();
+		Ogre::Vector3   getSize();
+
+
+		SphereCollisionShape*           createSphere();
+		BoxCollisionShape*              createBox();
+		TriangleMeshCollisionShape*     createTrimesh();
+		CylinderCollisionShape*         createCylinder();
+		ConvexHullCollisionShape*       createConvex();
+
+
+		const Ogre::Vector3*    getVertices();
+		unsigned int            getVertexCount();
+		const unsigned int*     getIndices();
+		unsigned int            getIndexCount();
+
+	protected:
+
+		void addStaticVertexData(const Ogre::VertexData *vertex_data);
+
+		void addAnimatedVertexData(const Ogre::VertexData *vertex_data, 
+							const Ogre::VertexData *blended_data, 
+							const Ogre::Mesh::IndexMap *indexMap);
+
+		void addIndexData(Ogre::IndexData *data, const unsigned int offset = 0);
+
+	
+	protected:
+		Ogre::Vector3*	    mVertexBuffer;
+		unsigned int*       mIndexBuffer;
+		unsigned int        mVertexCount;
+		unsigned int        mIndexCount;
+
+		Ogre::Matrix4		mTransform;
+
+		Ogre::Real		    mBoundRadius;
+		Ogre::Vector3		mBounds;
+
+		BoneIndex           *mBoneIndex;
+
+	};
+
+	class StaticMeshToShapeConverter : public VertexIndexToShape
+	{
+	public:
+
+		StaticMeshToShapeConverter(Ogre::Renderable *rend, const Ogre::Matrix4 &transform = Ogre::Matrix4::IDENTITY);
+		StaticMeshToShapeConverter(Ogre::Entity *entity,   const Ogre::Matrix4 &transform = Ogre::Matrix4::IDENTITY);
+		StaticMeshToShapeConverter();
+
+		~StaticMeshToShapeConverter();
+
+		void addEntity(Ogre::Entity *entity,const Ogre::Matrix4 &transform = Ogre::Matrix4::IDENTITY);
+		
+		void addMesh(const Ogre::MeshPtr &mesh, const Ogre::Matrix4 &transform = Ogre::Matrix4::IDENTITY);
+
+
+	protected:
+
+		Ogre::Entity*		mEntity;
+		Ogre::SceneNode*	mNode;
+
+	};
+
+	class AnimatedMeshToShapeConverter : public VertexIndexToShape
+	{
+	public:
+
+		AnimatedMeshToShapeConverter(Ogre::Entity *entity, const Ogre::Matrix4 &transform = Ogre::Matrix4::IDENTITY);
+		AnimatedMeshToShapeConverter();
+		~AnimatedMeshToShapeConverter();
+
+		void addEntity(Ogre::Entity *entity,const Ogre::Matrix4 &transform = Ogre::Matrix4::IDENTITY);
+		void addMesh(const Ogre::MeshPtr &mesh, const Ogre::Matrix4 &transform);
+
+		BoxCollisionShape* createAlignedBox(unsigned char bone, 
+			const Ogre::Vector3 &bonePosition,
+			const Ogre::Quaternion &boneOrientation);
+
+		BoxCollisionShape* createOrientedBox(unsigned char bone, 
+			const Ogre::Vector3 &bonePosition,
+			const Ogre::Quaternion &boneOrientation);
+
+		CapsuleCollisionShape* createOrientedCapsuleCollisionShape(unsigned char bone, 
+			const Ogre::Vector3 &bonePosition,
+			const Ogre::Quaternion &boneOrientation);
+
+	protected:
+
+		bool getBoneVertices(unsigned char bone, 
+			unsigned int &vertex_count, 
+			Ogre::Vector3* &vertices,
+			const Ogre::Vector3 &bonePosition);
+
+		bool getOrientedBox(unsigned char bone, 
+			const Ogre::Vector3 &bonePosition,
+			const Ogre::Quaternion &boneOrientation,
+			Ogre::Vector3 &extents,
+			Ogre::Vector3 *axis,
+			Ogre::Vector3 &center);
+
+		
+		Ogre::Entity*		mEntity;
+		Ogre::SceneNode*	mNode;
+
+		Ogre::Vector3       *mTransformedVerticesTemp;
+		size_t               mTransformedVerticesTempSize;
+
+	};
+
+}
+
+#endif
+
+
+
+
Index: /code/branches/physics/src/ogrebullet/Utils/OgreBulletConverter.h
===================================================================
--- /code/branches/physics/src/ogrebullet/Utils/OgreBulletConverter.h	(revision 1971)
+++ /code/branches/physics/src/ogrebullet/Utils/OgreBulletConverter.h	(revision 1971)
@@ -0,0 +1,71 @@
+/***************************************************************************
+
+This source file is part of OGREBULLET
+(Object-oriented Graphics Rendering Engine Bullet Wrapper)
+For the latest info, see http://www.ogre3d.org/phpBB2addons/viewforum.php?f=10
+
+Copyright (c) 2007 tuan.kuranes@gmail.com
+
+
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser 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 Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _OGREBULLETCOLLISIONS_OgreBtConverter_H
+#define _OGREBULLETCOLLISIONS_OgreBtConverter_H
+
+#include "OgreBulletCollisionsPreRequisites.h"
+
+#include "OgreVector3.h"
+#include "OgreQuaternion.h"
+
+namespace OgreBulletCollisions
+{
+    class OgreBtConverter
+    {
+    public:
+        OgreBtConverter(){};
+        ~OgreBtConverter(){};
+
+        static btVector3 to(const Ogre::Vector3 &V)
+        {
+            return btVector3(V.x, V.y, V.z);
+        };
+
+        static btQuaternion to(const Ogre::Quaternion &Q)
+        {
+            return btQuaternion(Q.x, Q.y, Q.z, Q.w);
+        };
+
+    };
+    class BtOgreConverter
+    {
+    public:
+        BtOgreConverter(){};
+        ~BtOgreConverter(){};
+
+        static Ogre::Vector3 to(const btVector3 &V)
+        {
+            return Ogre::Vector3(V.x(), V.y(), V.z());
+        };
+
+        static Ogre::Quaternion to(const btQuaternion &Q)
+        {
+            return Ogre::Quaternion(Q.w(), Q.x(), Q.y(), Q.z());
+            //return Ogre::Quaternion(Q.x(), Q.y(), Q.z(), Q[3]);
+        };
+    };
+}
+#endif //_OGREBULLETCOLLISIONS_OgreBtConverter_H
