Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp	(revision 2908)
@@ -53,5 +53,5 @@
 		{
 			m_doubleDispatch[i][j] = m_collisionConfiguration->getCollisionAlgorithmCreateFunc(i,j);
-			btAssert(m_doubleDispatch[i][j]);
+			assert(m_doubleDispatch[i][j]);
 		}
 	}
@@ -80,10 +80,6 @@
 	btCollisionObject* body1 = (btCollisionObject*)b1;
 
-	//test for Bullet 2.74: use a relative contact breaking threshold without clamping against 'gContactBreakingThreshold'
-	//btScalar contactBreakingThreshold = btMin(gContactBreakingThreshold,btMin(body0->getCollisionShape()->getContactBreakingThreshold(),body1->getCollisionShape()->getContactBreakingThreshold()));
-	btScalar contactBreakingThreshold = btMin(body0->getCollisionShape()->getContactBreakingThreshold(),body1->getCollisionShape()->getContactBreakingThreshold());
-
-	btScalar contactProcessingThreshold = btMin(body0->getContactProcessingThreshold(),body1->getContactProcessingThreshold());
-		
+	btScalar contactBreakingThreshold = btMin(gContactBreakingThreshold,btMin(body0->getCollisionShape()->getContactBreakingThreshold(),body1->getCollisionShape()->getContactBreakingThreshold()));
+	
 	void* mem = 0;
 	
@@ -96,5 +92,5 @@
 
 	}
-	btPersistentManifold* manifold = new(mem) btPersistentManifold (body0,body1,0,contactBreakingThreshold,contactProcessingThreshold);
+	btPersistentManifold* manifold = new(mem) btPersistentManifold (body0,body1,0,contactBreakingThreshold);
 	manifold->m_index1a = m_manifoldsPtr.size();
 	m_manifoldsPtr.push_back(manifold);
@@ -147,4 +143,5 @@
 	return algo;
 }
+
 
 
@@ -164,6 +161,6 @@
 bool	btCollisionDispatcher::needsCollision(btCollisionObject* body0,btCollisionObject* body1)
 {
-	btAssert(body0);
-	btAssert(body1);
+	assert(body0);
+	assert(body1);
 
 	bool needsCollision = true;
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionObject.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionObject.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionObject.cpp	(revision 2908)
@@ -18,8 +18,5 @@
 
 btCollisionObject::btCollisionObject()
-	:	m_anisotropicFriction(1.f,1.f,1.f),
-	m_hasAnisotropicFriction(false),
-	m_contactProcessingThreshold(1e30f),
-		m_broadphaseHandle(0),
+	:	m_broadphaseHandle(0),
 		m_collisionShape(0),
 		m_rootCollisionShape(0),
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionObject.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionObject.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionObject.h	(revision 2908)
@@ -53,9 +53,4 @@
 	btVector3	m_interpolationLinearVelocity;
 	btVector3	m_interpolationAngularVelocity;
-	
-	btVector3		m_anisotropicFriction;
-	bool				m_hasAnisotropicFriction;
-	btScalar		m_contactProcessingThreshold;	
-
 	btBroadphaseProxy*		m_broadphaseHandle;
 	btCollisionShape*		m_collisionShape;
@@ -120,9 +115,8 @@
 		CO_COLLISION_OBJECT =1,
 		CO_RIGID_BODY,
+		CO_SOFT_BODY,
 		///CO_GHOST_OBJECT keeps track of all objects overlapping its AABB and that pass its collision filter
 		///It is useful for collision sensors, explosion objects, character controller etc.
-		CO_GHOST_OBJECT,
-		CO_SOFT_BODY,
-		CO_HF_FLUID
+		CO_GHOST_OBJECT
 	};
 
@@ -133,28 +127,4 @@
 	}
 
-	const btVector3& getAnisotropicFriction() const
-	{
-		return m_anisotropicFriction;
-	}
-	void	setAnisotropicFriction(const btVector3& anisotropicFriction)
-	{
-		m_anisotropicFriction = anisotropicFriction;
-		m_hasAnisotropicFriction = (anisotropicFriction[0]!=1.f) || (anisotropicFriction[1]!=1.f) || (anisotropicFriction[2]!=1.f);
-	}
-	bool	hasAnisotropicFriction() const
-	{
-		return m_hasAnisotropicFriction;
-	}
-
-	///the constraint solver can discard solving contacts, if the distance is above this threshold. 0 by default.
-	///Note that using contacts with positive distance can improve stability. It increases, however, the chance of colliding with degerate contacts, such as 'interior' triangle edges
-	void	setContactProcessingThreshold( btScalar contactProcessingThreshold)
-	{
-		m_contactProcessingThreshold = contactProcessingThreshold;
-	}
-	btScalar	getContactProcessingThreshold() const
-	{
-		return m_contactProcessingThreshold;
-	}
 
 	SIMD_FORCE_INLINE bool		isStaticObject() const {
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.cpp	(revision 2908)
@@ -70,5 +70,4 @@
 			getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(bp,m_dispatcher1);
 			getBroadphase()->destroyProxy(bp,m_dispatcher1);
-			collisionObject->setBroadphaseHandle(0);
 		}
 	}
@@ -120,37 +119,4 @@
 
 
-void	btCollisionWorld::updateSingleAabb(btCollisionObject* colObj)
-{
-	btVector3 minAabb,maxAabb;
-	colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
-	//need to increase the aabb for contact thresholds
-	btVector3 contactThreshold(gContactBreakingThreshold,gContactBreakingThreshold,gContactBreakingThreshold);
-	minAabb -= contactThreshold;
-	maxAabb += contactThreshold;
-
-	btBroadphaseInterface* bp = (btBroadphaseInterface*)m_broadphasePairCache;
-
-	//moving objects should be moderately sized, probably something wrong if not
-	if ( colObj->isStaticObject() || ((maxAabb-minAabb).length2() < btScalar(1e12)))
-	{
-		bp->setAabb(colObj->getBroadphaseHandle(),minAabb,maxAabb, m_dispatcher1);
-	} else
-	{
-		//something went wrong, investigate
-		//this assert is unwanted in 3D modelers (danger of loosing work)
-		colObj->setActivationState(DISABLE_SIMULATION);
-
-		static bool reportMe = true;
-		if (reportMe && m_debugDrawer)
-		{
-			reportMe = false;
-			m_debugDrawer->reportErrorWarning("Overflow in AABB, object removed from simulation");
-			m_debugDrawer->reportErrorWarning("If you can reproduce this, please email bugs@continuousphysics.com\n");
-			m_debugDrawer->reportErrorWarning("Please include above information, your Platform, version of OS.\n");
-			m_debugDrawer->reportErrorWarning("Thanks.\n");
-		}
-	}
-}
-
 void	btCollisionWorld::updateAabbs()
 {
@@ -165,7 +131,36 @@
 		if (colObj->isActive())
 		{
-			updateSingleAabb(colObj);
-		}
-	}
+			btVector3 minAabb,maxAabb;
+			colObj->getCollisionShape()->getAabb(colObj->getWorldTransform(), minAabb,maxAabb);
+			//need to increase the aabb for contact thresholds
+			btVector3 contactThreshold(gContactBreakingThreshold,gContactBreakingThreshold,gContactBreakingThreshold);
+			minAabb -= contactThreshold;
+			maxAabb += contactThreshold;
+
+			btBroadphaseInterface* bp = (btBroadphaseInterface*)m_broadphasePairCache;
+
+			//moving objects should be moderately sized, probably something wrong if not
+			if ( colObj->isStaticObject() || ((maxAabb-minAabb).length2() < btScalar(1e12)))
+			{
+				bp->setAabb(colObj->getBroadphaseHandle(),minAabb,maxAabb, m_dispatcher1);
+			} else
+			{
+				//something went wrong, investigate
+				//this assert is unwanted in 3D modelers (danger of loosing work)
+				colObj->setActivationState(DISABLE_SIMULATION);
+
+				static bool reportMe = true;
+				if (reportMe && m_debugDrawer)
+				{
+					reportMe = false;
+					m_debugDrawer->reportErrorWarning("Overflow in AABB, object removed from simulation");
+					m_debugDrawer->reportErrorWarning("If you can reproduce this, please email bugs@continuousphysics.com\n");
+					m_debugDrawer->reportErrorWarning("Please include above information, your Platform, version of OS.\n");
+					m_debugDrawer->reportErrorWarning("Thanks.\n");
+				}
+			}
+		}
+	}
+
 }
 
@@ -299,6 +294,5 @@
 					BridgeTriangleRaycastCallback( const btVector3& from,const btVector3& to,
 						btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btTriangleMeshShape*	triangleMesh):
-                  //@BP Mod
-						btTriangleRaycastCallback(from,to, resultCallback->m_flags),
+						btTriangleRaycastCallback(from,to),
 							m_resultCallback(resultCallback),
 							m_collisionObject(collisionObject),
@@ -349,6 +343,5 @@
 					BridgeTriangleRaycastCallback( const btVector3& from,const btVector3& to,
 						btCollisionWorld::RayResultCallback* resultCallback, btCollisionObject* collisionObject,btConcaveShape*	triangleMesh):
-                  //@BP Mod
-                  btTriangleRaycastCallback(from,to, resultCallback->m_flags),
+						btTriangleRaycastCallback(from,to),
 							m_resultCallback(resultCallback),
 							m_collisionObject(collisionObject),
@@ -671,5 +664,5 @@
 			//RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
 			//btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
-#if 0
+			
 #ifdef RECALCULATE_AABB
 			btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
@@ -679,5 +672,4 @@
 			const btVector3& collisionObjectAabbMin = collisionObject->getBroadphaseHandle()->m_aabbMin;
 			const btVector3& collisionObjectAabbMax = collisionObject->getBroadphaseHandle()->m_aabbMax;
-#endif
 #endif
 			//btScalar hitLambda = m_resultCallback.m_closestHitFraction;
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCollisionWorld.h	(revision 2908)
@@ -59,6 +59,4 @@
  * 
  */
-
-
  
  
@@ -82,10 +80,8 @@
 {
 
-
 	
 protected:
 
 	btAlignedObjectArray<btCollisionObject*>	m_collisionObjects;
-
 	
 	btDispatcher*	m_dispatcher1;
@@ -99,5 +95,4 @@
 	btIDebugDraw*	m_debugDrawer;
 
-
 	
 public:
@@ -138,6 +133,4 @@
 		return m_dispatcher1;
 	}
-
-	void	updateSingleAabb(btCollisionObject* colObj);
 
 	virtual void	updateAabbs();
@@ -161,5 +154,4 @@
 		int	m_shapePart;
 		int	m_triangleIndex;
-
 		
 		//const btCollisionShape*	m_shapeTemp;
@@ -194,6 +186,4 @@
 		short int	m_collisionFilterGroup;
 		short int	m_collisionFilterMask;
-      //@BP Mod - Custom flags, currently used to enable backface culling on tri-meshes, see btRaycastCallback
-      unsigned int m_flags;
 
 		virtual ~RayResultCallback()
@@ -209,7 +199,5 @@
 			m_collisionObject(0),
 			m_collisionFilterGroup(btBroadphaseProxy::DefaultFilter),
-			m_collisionFilterMask(btBroadphaseProxy::AllFilter),
-         //@BP Mod
-         m_flags(0)
+			m_collisionFilterMask(btBroadphaseProxy::AllFilter)
 		{
 		}
@@ -239,5 +227,4 @@
 		btVector3	m_hitNormalWorld;
 		btVector3	m_hitPointWorld;
-
 			
 		virtual	btScalar	addSingleResult(LocalRayResult& rayResult,bool normalInWorldSpace)
@@ -245,5 +232,4 @@
 			//caller already does the filter on the m_closestHitFraction
 			btAssert(rayResult.m_hitFraction <= m_closestHitFraction);
-
 			
 			m_closestHitFraction = rayResult.m_hitFraction;
@@ -292,5 +278,4 @@
 		short int	m_collisionFilterGroup;
 		short int	m_collisionFilterMask;
-
 		
 		ConvexResultCallback()
@@ -304,5 +289,4 @@
 		{
 		}
-
 		
 		bool	hasHit() const
@@ -310,5 +294,4 @@
 			return (m_closestHitFraction < btScalar(1.));
 		}
-
 
 		
@@ -339,5 +322,4 @@
 		btVector3	m_hitPointWorld;
 		btCollisionObject*	m_hitCollisionObject;
-
 		
 		virtual	btScalar	addSingleResult(LocalConvexResult& convexResult,bool normalInWorldSpace)
@@ -345,5 +327,4 @@
 //caller already does the filter on the m_closestHitFraction
 			btAssert(convexResult.m_hitFraction <= m_closestHitFraction);
-
 						
 			m_closestHitFraction = convexResult.m_hitFraction;
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp	(revision 2908)
@@ -20,5 +20,4 @@
 #include "LinearMath/btIDebugDraw.h"
 #include "LinearMath/btAabbUtil2.h"
-#include "btManifoldResult.h"
 
 btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped)
@@ -30,20 +29,8 @@
 
 	btCollisionObject* colObj = m_isSwapped? body1 : body0;
-	btAssert (colObj->getCollisionShape()->isCompound());
+	btCollisionObject* otherObj = m_isSwapped? body0 : body1;
+	assert (colObj->getCollisionShape()->isCompound());
 	
 	btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
-	m_compoundShapeRevision = compoundShape->getUpdateRevision();
-	
-	preallocateChildAlgorithms(body0,body1);
-}
-
-void	btCompoundCollisionAlgorithm::preallocateChildAlgorithms(btCollisionObject* body0,btCollisionObject* body1)
-{
-	btCollisionObject* colObj = m_isSwapped? body1 : body0;
-	btCollisionObject* otherObj = m_isSwapped? body0 : body1;
-	btAssert (colObj->getCollisionShape()->isCompound());
-	
-	btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
-
 	int numChildren = compoundShape->getNumChildShapes();
 	int i;
@@ -60,5 +47,5 @@
 			btCollisionShape* childShape = compoundShape->getChildShape(i);
 			colObj->internalSetTemporaryCollisionShape( childShape );
-			m_childCollisionAlgorithms[i] = m_dispatcher->findAlgorithm(colObj,otherObj,m_sharedManifold);
+			m_childCollisionAlgorithms[i] = ci.m_dispatcher1->findAlgorithm(colObj,otherObj,m_sharedManifold);
 			colObj->internalSetTemporaryCollisionShape( tmpShape );
 		}
@@ -66,5 +53,6 @@
 }
 
-void	btCompoundCollisionAlgorithm::removeChildAlgorithms()
+
+btCompoundCollisionAlgorithm::~btCompoundCollisionAlgorithm()
 {
 	int numChildren = m_childCollisionAlgorithms.size();
@@ -78,9 +66,4 @@
 		}
 	}
-}
-
-btCompoundCollisionAlgorithm::~btCompoundCollisionAlgorithm()
-{
-	removeChildAlgorithms();
 }
 
@@ -185,19 +168,6 @@
 	btCollisionObject* otherObj = m_isSwapped? body0 : body1;
 
-	
-
-	btAssert (colObj->getCollisionShape()->isCompound());
+	assert (colObj->getCollisionShape()->isCompound());
 	btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
-
-	///btCompoundShape might have changed:
-	////make sure the internal child collision algorithm caches are still valid
-	if (compoundShape->getUpdateRevision() != m_compoundShapeRevision)
-	{
-		///clear and update all
-		removeChildAlgorithms();
-		
-		preallocateChildAlgorithms(body0,body1);
-	}
-
 
 	btDbvt* tree = compoundShape->getDynamicAabbTree();
@@ -205,28 +175,4 @@
 	btCompoundLeafCallback  callback(colObj,otherObj,m_dispatcher,dispatchInfo,resultOut,&m_childCollisionAlgorithms[0],m_sharedManifold);
 
-	///we need to refresh all contact manifolds
-	///note that we should actually recursively traverse all children, btCompoundShape can nested more then 1 level deep
-	///so we should add a 'refreshManifolds' in the btCollisionAlgorithm
-	{
-		int i;
-		btManifoldArray manifoldArray;
-		for (i=0;i<m_childCollisionAlgorithms.size();i++)
-		{
-			if (m_childCollisionAlgorithms[i])
-			{
-				m_childCollisionAlgorithms[i]->getAllContactManifolds(manifoldArray);
-				for (int m=0;m<manifoldArray.size();m++)
-				{
-					if (manifoldArray[m]->getNumContacts())
-					{
-						resultOut->setPersistentManifold(manifoldArray[m]);
-						resultOut->refreshContactPoints();
-						resultOut->setPersistentManifold(0);//??necessary?
-					}
-				}
-				manifoldArray.clear();
-			}
-		}
-	}
 
 	if (tree)
@@ -297,5 +243,5 @@
 	btCollisionObject* otherObj = m_isSwapped? body0 : body1;
 
-	btAssert (colObj->getCollisionShape()->isCompound());
+	assert (colObj->getCollisionShape()->isCompound());
 	
 	btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
@@ -340,3 +286,2 @@
 
 
-
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h	(revision 2908)
@@ -27,5 +27,4 @@
 #include "LinearMath/btAlignedObjectArray.h"
 class btDispatcher;
-class btCollisionObject;
 
 /// btCompoundCollisionAlgorithm  supports collision between CompoundCollisionShapes and other collision shapes
@@ -37,11 +36,5 @@
 	class btPersistentManifold*	m_sharedManifold;
 	bool					m_ownsManifold;
-
-	int	m_compoundShapeRevision;//to keep track of changes, so that childAlgorithm array can be updated
 	
-	void	removeChildAlgorithms();
-	
-	void	preallocateChildAlgorithms(btCollisionObject* body0,btCollisionObject* body1);
-
 public:
 
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp	(revision 2908)
@@ -52,6 +52,4 @@
 btConvexConvexAlgorithm::CreateFunc::CreateFunc(btSimplexSolverInterface*			simplexSolver, btConvexPenetrationDepthSolver* pdSolver)
 {
-	m_numPerturbationIterations = 0;
-	m_minimumPointsPerturbationThreshold = 3;
 	m_simplexSolver = simplexSolver;
 	m_pdSolver = pdSolver;
@@ -62,5 +60,5 @@
 }
 
-btConvexConvexAlgorithm::btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver,int numPerturbationIterations, int minimumPointsPerturbationThreshold)
+btConvexConvexAlgorithm::btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver)
 : btActivatingCollisionAlgorithm(ci,body0,body1),
 m_simplexSolver(simplexSolver),
@@ -68,11 +66,9 @@
 m_ownManifold (false),
 m_manifoldPtr(mf),
-m_lowLevelOfDetail(false),
+m_lowLevelOfDetail(false)
 #ifdef USE_SEPDISTANCE_UTIL2
 ,m_sepDistance((static_cast<btConvexShape*>(body0->getCollisionShape()))->getAngularMotionDisc(),
-			  (static_cast<btConvexShape*>(body1->getCollisionShape()))->getAngularMotionDisc()),
+			  (static_cast<btConvexShape*>(body1->getCollisionShape()))->getAngularMotionDisc())
 #endif
-m_numPerturbationIterations(numPerturbationIterations),
-m_minimumPointsPerturbationThreshold(minimumPointsPerturbationThreshold)
 {
 	(void)body0;
@@ -98,61 +94,6 @@
 
 
-struct btPerturbedContactResult : public btManifoldResult
-{
-	btManifoldResult* m_originalManifoldResult;
-	btTransform m_transformA;
-	btTransform m_transformB;
-	btTransform	m_unPerturbedTransform;
-	bool	m_perturbA;
-	btIDebugDraw*	m_debugDrawer;
-
-
-	btPerturbedContactResult(btManifoldResult* originalResult,const btTransform& transformA,const btTransform& transformB,const btTransform& unPerturbedTransform,bool perturbA,btIDebugDraw* debugDrawer)
-		:m_originalManifoldResult(originalResult),
-		m_transformA(transformA),
-		m_transformB(transformB),
-		m_perturbA(perturbA),
-		m_unPerturbedTransform(unPerturbedTransform),
-		m_debugDrawer(debugDrawer)
-	{
-	}
-	virtual ~ btPerturbedContactResult()
-	{
-	}
-
-	virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar orgDepth)
-	{
-		btVector3 endPt,startPt;
-		btScalar newDepth;
-		btVector3 newNormal;
-
-		if (m_perturbA)
-		{
-			btVector3 endPtOrg = pointInWorld + normalOnBInWorld*orgDepth;
-			endPt = (m_unPerturbedTransform*m_transformA.inverse())(endPtOrg);
-			newDepth = (endPt -  pointInWorld).dot(normalOnBInWorld);
-			startPt = endPt+normalOnBInWorld*newDepth;
-		} else
-		{
-			endPt = pointInWorld + normalOnBInWorld*orgDepth;
-			startPt = (m_unPerturbedTransform*m_transformB.inverse())(pointInWorld);
-			newDepth = (endPt -  startPt).dot(normalOnBInWorld);
-			
-		}
-
-//#define DEBUG_CONTACTS 1
-#ifdef DEBUG_CONTACTS
-		m_debugDrawer->drawLine(startPt,endPt,btVector3(1,0,0));
-		m_debugDrawer->drawSphere(startPt,0.05,btVector3(0,1,0));
-		m_debugDrawer->drawSphere(endPt,0.05,btVector3(0,0,1));
-#endif //DEBUG_CONTACTS
-
-		
-		m_originalManifoldResult->addContactPoint(normalOnBInWorld,startPt,newDepth);
-	}
-
-};
-
-extern btScalar gContactBreakingThreshold;
+
+
 
 //
@@ -170,6 +111,4 @@
 	resultOut->setPersistentManifold(m_manifoldPtr);
 
-	//comment-out next line to test multi-contact generation
-	//resultOut->getPersistentManifold()->clearManifold();
 	
 
@@ -208,75 +147,6 @@
 
 	gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
+
 	btScalar sepDist = gjkPairDetector.getCachedSeparatingDistance()+dispatchInfo.m_convexConservativeDistanceThreshold;
-
-	//now perturbe directions to get multiple contact points
-	btVector3 v0,v1;
-	btVector3 sepNormalWorldSpace = gjkPairDetector.getCachedSeparatingAxis().normalized();
-	btPlaneSpace1(sepNormalWorldSpace,v0,v1);
-	//now perform 'm_numPerturbationIterations' collision queries with the perturbated collision objects
-	
-	//perform perturbation when more then 'm_minimumPointsPerturbationThreshold' points
-	if (resultOut->getPersistentManifold()->getNumContacts() < m_minimumPointsPerturbationThreshold)
-	{
-		
-		int i;
-
-		bool perturbeA = true;
-		const btScalar angleLimit = 0.125f * SIMD_PI;
-		btScalar perturbeAngle;
-		btScalar radiusA = min0->getAngularMotionDisc();
-		btScalar radiusB = min1->getAngularMotionDisc();
-		if (radiusA < radiusB)
-		{
-			perturbeAngle = gContactBreakingThreshold /radiusA;
-			perturbeA = true;
-		} else
-		{
-			perturbeAngle = gContactBreakingThreshold / radiusB;
-			perturbeA = false;
-		}
-		if ( perturbeAngle > angleLimit ) 
-				perturbeAngle = angleLimit;
-
-		btTransform unPerturbedTransform;
-		if (perturbeA)
-		{
-			unPerturbedTransform = input.m_transformA;
-		} else
-		{
-			unPerturbedTransform = input.m_transformB;
-		}
-		
-		for ( i=0;i<m_numPerturbationIterations;i++)
-		{
-			btQuaternion perturbeRot(v0,perturbeAngle);
-			btScalar iterationAngle = i*(SIMD_2_PI/btScalar(m_numPerturbationIterations));
-			btQuaternion rotq(sepNormalWorldSpace,iterationAngle);
-			
-			
-			if (perturbeA)
-			{
-				input.m_transformA.setBasis(  btMatrix3x3(rotq.inverse()*perturbeRot*rotq)*body0->getWorldTransform().getBasis());
-				input.m_transformB = body1->getWorldTransform();
-#ifdef DEBUG_CONTACTS
-				dispatchInfo.m_debugDraw->drawTransform(input.m_transformA,10.0);
-#endif //DEBUG_CONTACTS
-			} else
-			{
-				input.m_transformA = body0->getWorldTransform();
-				input.m_transformB.setBasis( btMatrix3x3(rotq.inverse()*perturbeRot*rotq)*body1->getWorldTransform().getBasis());
-#ifdef DEBUG_CONTACTS
-				dispatchInfo.m_debugDraw->drawTransform(input.m_transformB,10.0);
-#endif
-			}
-			
-			btPerturbedContactResult perturbedResultOut(resultOut,input.m_transformA,input.m_transformB,unPerturbedTransform,perturbeA,dispatchInfo.m_debugDraw);
-			gjkPairDetector.getClosestPoints(input,perturbedResultOut,dispatchInfo.m_debugDraw);
-			
-			
-		}
-	}
-
-	
 
 #ifdef USE_SEPDISTANCE_UTIL2
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h	(revision 2908)
@@ -34,7 +34,5 @@
 ///#define USE_SEPDISTANCE_UTIL2 1
 
-///The convexConvexAlgorithm collision algorithm implements time of impact, convex closest points and penetration depth calculations between two convex objects.
-///Multiple contact points are calculated by perturbing the orientation of the smallest object orthogonal to the separating normal.
-///This idea was described by Gino van den Bergen in this forum topic http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=4&t=288&p=888#p888
+///ConvexConvexAlgorithm collision algorithm implements time of impact, convex closest points and penetration depth calculations.
 class btConvexConvexAlgorithm : public btActivatingCollisionAlgorithm
 {
@@ -50,8 +48,4 @@
 	bool			m_lowLevelOfDetail;
 	
-	int m_numPerturbationIterations;
-	int m_minimumPointsPerturbationThreshold;
-
-
 	///cache separating vector to speedup collision detection
 	
@@ -59,6 +53,5 @@
 public:
 
-	btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold);
-
+	btConvexConvexAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1, btSimplexSolverInterface* simplexSolver, btConvexPenetrationDepthSolver* pdSolver);
 
 	virtual ~btConvexConvexAlgorithm();
@@ -86,10 +79,7 @@
 	struct CreateFunc :public 	btCollisionAlgorithmCreateFunc
 	{
-
 		btConvexPenetrationDepthSolver*		m_pdSolver;
 		btSimplexSolverInterface*			m_simplexSolver;
-		int m_numPerturbationIterations;
-		int m_minimumPointsPerturbationThreshold;
-
+		
 		CreateFunc(btSimplexSolverInterface*			simplexSolver, btConvexPenetrationDepthSolver* pdSolver);
 		
@@ -99,5 +89,5 @@
 		{
 			void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexConvexAlgorithm));
-			return new(mem) btConvexConvexAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold);
+			return new(mem) btConvexConvexAlgorithm(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver);
 		}
 	};
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp	(revision 2908)
@@ -5,6 +5,6 @@
 This software is provided 'as-is', without any express or implied warranty.
 In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
+Permission is granted to anyone to use this software for any purpose, 
+including commercial applications, and to alter it and redistribute it freely, 
 subject to the following restrictions:
 
@@ -23,15 +23,13 @@
 //#include <stdio.h>
 
-btConvexPlaneCollisionAlgorithm::btConvexPlaneCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped, int numPerturbationIterations,int minimumPointsPerturbationThreshold)
+btConvexPlaneCollisionAlgorithm::btConvexPlaneCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped)
 : btCollisionAlgorithm(ci),
 m_ownManifold(false),
 m_manifoldPtr(mf),
-m_isSwapped(isSwapped),
-m_numPerturbationIterations(numPerturbationIterations),
-m_minimumPointsPerturbationThreshold(minimumPointsPerturbationThreshold)
+m_isSwapped(isSwapped)
 {
 	btCollisionObject* convexObj = m_isSwapped? col1 : col0;
 	btCollisionObject* planeObj = m_isSwapped? col0 : col1;
-
+	
 	if (!m_manifoldPtr && m_dispatcher->needsCollision(convexObj,planeObj))
 	{
@@ -51,7 +49,14 @@
 }
 
-void btConvexPlaneCollisionAlgorithm::collideSingleContact (const btQuaternion& perturbeRot, btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
+
+
+void btConvexPlaneCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
 {
-    btCollisionObject* convexObj = m_isSwapped? body1 : body0;
+	(void)dispatchInfo;
+	(void)resultOut;
+	if (!m_manifoldPtr)
+		return;
+
+	btCollisionObject* convexObj = m_isSwapped? body1 : body0;
 	btCollisionObject* planeObj = m_isSwapped? body0: body1;
 
@@ -59,18 +64,13 @@
 	btStaticPlaneShape* planeShape = (btStaticPlaneShape*) planeObj->getCollisionShape();
 
-    bool hasCollision = false;
+	bool hasCollision = false;
 	const btVector3& planeNormal = planeShape->getPlaneNormal();
 	const btScalar& planeConstant = planeShape->getPlaneConstant();
-	
-	btTransform convexWorldTransform = convexObj->getWorldTransform();
+	btTransform planeInConvex;
+	planeInConvex= convexObj->getWorldTransform().inverse() * planeObj->getWorldTransform();
 	btTransform convexInPlaneTrans;
-	convexInPlaneTrans= planeObj->getWorldTransform().inverse() * convexWorldTransform;
-	//now perturbe the convex-world transform
-	convexWorldTransform.getBasis()*=btMatrix3x3(perturbeRot);
-	btTransform planeInConvex;
-	planeInConvex= convexWorldTransform.inverse() * planeObj->getWorldTransform();
-	
+	convexInPlaneTrans= planeObj->getWorldTransform().inverse() * convexObj->getWorldTransform();
+
 	btVector3 vtx = convexShape->localGetSupportingVertex(planeInConvex.getBasis()*-planeNormal);
-
 	btVector3 vtxInPlane = convexInPlaneTrans(vtx);
 	btScalar distance = (planeNormal.dot(vtxInPlane) - planeConstant);
@@ -88,51 +88,4 @@
 		resultOut->addContactPoint(normalOnSurfaceB,pOnB,distance);
 	}
-}
-
-
-void btConvexPlaneCollisionAlgorithm::processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut)
-{
-	(void)dispatchInfo;
-	if (!m_manifoldPtr)
-		return;
-
-    btCollisionObject* convexObj = m_isSwapped? body1 : body0;
-	btCollisionObject* planeObj = m_isSwapped? body0: body1;
-
-	btConvexShape* convexShape = (btConvexShape*) convexObj->getCollisionShape();
-	btStaticPlaneShape* planeShape = (btStaticPlaneShape*) planeObj->getCollisionShape();
-
-    bool hasCollision = false;
-	const btVector3& planeNormal = planeShape->getPlaneNormal();
-	const btScalar& planeConstant = planeShape->getPlaneConstant();
-
-	//first perform a collision query with the non-perturbated collision objects
-	{
-		btQuaternion rotq(0,0,0,1);
-		collideSingleContact(rotq,body0,body1,dispatchInfo,resultOut);
-	}
-
-	if (resultOut->getPersistentManifold()->getNumContacts()<m_minimumPointsPerturbationThreshold)
-	{
-		btVector3 v0,v1;
-		btPlaneSpace1(planeNormal,v0,v1);
-		//now perform 'm_numPerturbationIterations' collision queries with the perturbated collision objects
-
-		const btScalar angleLimit = 0.125f * SIMD_PI;
-		btScalar perturbeAngle;
-		btScalar radius = convexShape->getAngularMotionDisc();
-		perturbeAngle = gContactBreakingThreshold / radius;
-		if ( perturbeAngle > angleLimit ) 
-				perturbeAngle = angleLimit;
-
-		btQuaternion perturbeRot(v0,perturbeAngle);
-		for (int i=0;i<m_numPerturbationIterations;i++)
-		{
-			btScalar iterationAngle = i*(SIMD_2_PI/btScalar(m_numPerturbationIterations));
-			btQuaternion rotq(planeNormal,iterationAngle);
-			collideSingleContact(rotq.inverse()*perturbeRot*rotq,body0,body1,dispatchInfo,resultOut);
-		}
-	}
-
 	if (m_ownManifold)
 	{
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h	(revision 2908)
@@ -5,6 +5,6 @@
 This software is provided 'as-is', without any express or implied warranty.
 In no event will the authors be held liable for any damages arising from the use of this software.
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it freely,
+Permission is granted to anyone to use this software for any purpose, 
+including commercial applications, and to alter it and redistribute it freely, 
 subject to the following restrictions:
 
@@ -29,19 +29,15 @@
 class btConvexPlaneCollisionAlgorithm : public btCollisionAlgorithm
 {
-	bool		m_ownManifold;
+	bool	m_ownManifold;
 	btPersistentManifold*	m_manifoldPtr;
-	bool		m_isSwapped;
-	int			m_numPerturbationIterations;
-	int			m_minimumPointsPerturbationThreshold;
-
+	bool	m_isSwapped;
+	
 public:
 
-	btConvexPlaneCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped, int numPerturbationIterations,int minimumPointsPerturbationThreshold);
+	btConvexPlaneCollisionAlgorithm(btPersistentManifold* mf,const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* col0,btCollisionObject* col1, bool isSwapped);
 
 	virtual ~btConvexPlaneCollisionAlgorithm();
 
 	virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
-
-	void collideSingleContact (const btQuaternion& perturbeRot, btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
 
 	virtual btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
@@ -57,13 +53,4 @@
 	struct CreateFunc :public 	btCollisionAlgorithmCreateFunc
 	{
-		int	m_numPerturbationIterations;
-		int m_minimumPointsPerturbationThreshold;
-			
-		CreateFunc() 
-			: m_numPerturbationIterations(3),
-			m_minimumPointsPerturbationThreshold(3)
-		{
-		}
-		
 		virtual	btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
 		{
@@ -71,8 +58,8 @@
 			if (!m_swapped)
 			{
-				return new(mem) btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,false,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold);
+				return new(mem) btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,false);
 			} else
 			{
-				return new(mem) btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,true,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold);
+				return new(mem) btConvexPlaneCollisionAlgorithm(0,ci,body0,body1,true);
 			}
 		}
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp	(revision 2908)
@@ -289,9 +289,2 @@
 	return m_emptyCreateFunc;
 }
-
-void btDefaultCollisionConfiguration::setConvexConvexMultipointIterations(int numPerturbationIterations, int minimumPointsPerturbationThreshold)
-{
-	btConvexConvexAlgorithm::CreateFunc* convexConvex = (btConvexConvexAlgorithm::CreateFunc*) m_convexConvexCreateFunc;
-	convexConvex->m_numPerturbationIterations = numPerturbationIterations;
-	convexConvex->m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
-}
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h	(revision 2908)
@@ -112,12 +112,4 @@
 	virtual btCollisionAlgorithmCreateFunc* getCollisionAlgorithmCreateFunc(int proxyType0,int proxyType1);
 
-	///Use this method to allow to generate multiple contact points between at once, between two objects using the generic convex-convex algorithm.
-	///By default, this feature is disabled for best performance.
-	///@param numPerturbationIterations controls the number of collision queries. Set it to zero to disable the feature.
-	///@param minimumPointsPerturbationThreshold is the minimum number of points in the contact cache, above which the feature is disabled
-	///3 is a good value for both params, if you want to enable the feature. This is because the default contact cache contains a maximum of 4 points, and one collision query at the unperturbed orientation is performed first.
-	///See Bullet/Demos/CollisionDemo for an example how this feature gathers multiple points.
-	///@todo we could add a per-object setting of those parameters, for level-of-detail collision detection.
-	void	setConvexConvexMultipointIterations(int numPerturbationIterations=3, int minimumPointsPerturbationThreshold = 3);
 
 };
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btGhostObject.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btGhostObject.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btGhostObject.cpp	(revision 2908)
@@ -64,5 +64,4 @@
 btPairCachingGhostObject::~btPairCachingGhostObject()
 {
-	m_hashPairCache->~btHashedOverlappingPairCache();
 	btAlignedFree( m_hashPairCache );
 }
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btManifoldResult.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btManifoldResult.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btManifoldResult.cpp	(revision 2908)
@@ -56,5 +56,5 @@
 void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)
 {
-	btAssert(m_manifoldPtr);
+	assert(m_manifoldPtr);
 	//order in manifold needs to match
 	
@@ -93,5 +93,5 @@
    newPt.m_index0  = m_index0;
    newPt.m_index1  = m_index1;
-	//printf("depth=%f\n",depth);
+	
 	///@todo, check this for any side effects
 	if (insertIndex >= 0)
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btManifoldResult.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btManifoldResult.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btManifoldResult.h	(revision 2908)
@@ -46,6 +46,4 @@
 	int m_index0;
 	int m_index1;
-	
-
 public:
 
@@ -80,5 +78,4 @@
 	}
 
-
 	virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth);
 
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp	(revision 2908)
@@ -25,6 +25,5 @@
 #include "LinearMath/btQuickprof.h"
 
-btSimulationIslandManager::btSimulationIslandManager():
-m_splitIslands(true)
+btSimulationIslandManager::btSimulationIslandManager()
 {
 }
@@ -45,8 +44,8 @@
 	
 	{
-		
+		btBroadphasePair* pairPtr = colWorld->getPairCache()->getOverlappingPairArrayPtr();
+
 		for (int i=0;i<colWorld->getPairCache()->getNumOverlappingPairs();i++)
 		{
-			btBroadphasePair* pairPtr = colWorld->getPairCache()->getOverlappingPairArrayPtr();
 			const btBroadphasePair& collisionPair = pairPtr[i];
 			btCollisionObject* colObj0 = (btCollisionObject*)collisionPair.m_pProxy0->m_clientObject;
@@ -187,5 +186,5 @@
 			}
 
-			btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
+			assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
 			if (colObj0->getIslandTag() == islandId)
 			{
@@ -214,5 +213,5 @@
 				}
 
-				btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
+				assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
 
 				if (colObj0->getIslandTag() == islandId)
@@ -235,5 +234,5 @@
 				}
 
-				btAssert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
+				assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
 
 				if (colObj0->getIslandTag() == islandId)
@@ -253,9 +252,9 @@
 	int maxNumManifolds = dispatcher->getNumManifolds();
 
-//#define SPLIT_ISLANDS 1
-//#ifdef SPLIT_ISLANDS
-
-	
-//#endif //SPLIT_ISLANDS
+#define SPLIT_ISLANDS 1
+#ifdef SPLIT_ISLANDS
+
+	
+#endif //SPLIT_ISLANDS
 
 	
@@ -281,10 +280,9 @@
 				colObj0->activate();
 			}
-			if(m_splitIslands)
-			{ 
-				//filtering for response
-				if (dispatcher->needsResponse(colObj0,colObj1))
-					m_islandmanifold.push_back(manifold);
-			}
+#ifdef SPLIT_ISLANDS
+	//		//filtering for response
+			if (dispatcher->needsResponse(colObj0,colObj1))
+				m_islandmanifold.push_back(manifold);
+#endif //SPLIT_ISLANDS
 		}
 	}
@@ -306,85 +304,83 @@
 	BT_PROFILE("processIslands");
 
-	if(!m_splitIslands)
-	{
-		btPersistentManifold** manifold = dispatcher->getInternalManifoldPointer();
-		int maxNumManifolds = dispatcher->getNumManifolds();
-		callback->ProcessIsland(&collisionObjects[0],collisionObjects.size(),manifold,maxNumManifolds, -1);
-	}
-	else
-	{
-		// Sort manifolds, based on islands
-		// Sort the vector using predicate and std::sort
-		//std::sort(islandmanifold.begin(), islandmanifold.end(), btPersistentManifoldSortPredicate);
-
-		int numManifolds = int (m_islandmanifold.size());
-
-		//we should do radix sort, it it much faster (O(n) instead of O (n log2(n))
-		m_islandmanifold.quickSort(btPersistentManifoldSortPredicate());
-
-		//now process all active islands (sets of manifolds for now)
-
-		int startManifoldIndex = 0;
-		int endManifoldIndex = 1;
-
-		//int islandId;
-
-		
-
-	//	printf("Start Islands\n");
-
-		//traverse the simulation islands, and call the solver, unless all objects are sleeping/deactivated
-		for ( startIslandIndex=0;startIslandIndex<numElem;startIslandIndex = endIslandIndex)
-		{
-			int islandId = getUnionFind().getElement(startIslandIndex).m_id;
-
-
-			   bool islandSleeping = false;
-	                
-					for (endIslandIndex = startIslandIndex;(endIslandIndex<numElem) && (getUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
-					{
-							int i = getUnionFind().getElement(endIslandIndex).m_sz;
-							btCollisionObject* colObj0 = collisionObjects[i];
-							m_islandBodies.push_back(colObj0);
-							if (!colObj0->isActive())
-									islandSleeping = true;
-					}
-	                
-
-			//find the accompanying contact manifold for this islandId
-			int numIslandManifolds = 0;
-			btPersistentManifold** startManifold = 0;
-
-			if (startManifoldIndex<numManifolds)
-			{
-				int curIslandId = getIslandId(m_islandmanifold[startManifoldIndex]);
-				if (curIslandId == islandId)
-				{
-					startManifold = &m_islandmanifold[startManifoldIndex];
-				
-					for (endManifoldIndex = startManifoldIndex+1;(endManifoldIndex<numManifolds) && (islandId == getIslandId(m_islandmanifold[endManifoldIndex]));endManifoldIndex++)
-					{
-
-					}
-					/// Process the actual simulation, only if not sleeping/deactivated
-					numIslandManifolds = endManifoldIndex-startManifoldIndex;
-				}
-
-			}
-
-			if (!islandSleeping)
-			{
-				callback->ProcessIsland(&m_islandBodies[0],m_islandBodies.size(),startManifold,numIslandManifolds, islandId);
-	//			printf("Island callback of size:%d bodies, %d manifolds\n",islandBodies.size(),numIslandManifolds);
-			}
+#ifndef SPLIT_ISLANDS
+	btPersistentManifold** manifold = dispatcher->getInternalManifoldPointer();
+	
+	callback->ProcessIsland(&collisionObjects[0],collisionObjects.size(),manifold,maxNumManifolds, -1);
+#else
+	// Sort manifolds, based on islands
+	// Sort the vector using predicate and std::sort
+	//std::sort(islandmanifold.begin(), islandmanifold.end(), btPersistentManifoldSortPredicate);
+
+	int numManifolds = int (m_islandmanifold.size());
+
+	//we should do radix sort, it it much faster (O(n) instead of O (n log2(n))
+	m_islandmanifold.quickSort(btPersistentManifoldSortPredicate());
+
+	//now process all active islands (sets of manifolds for now)
+
+	int startManifoldIndex = 0;
+	int endManifoldIndex = 1;
+
+	//int islandId;
+
+	
+
+//	printf("Start Islands\n");
+
+	//traverse the simulation islands, and call the solver, unless all objects are sleeping/deactivated
+	for ( startIslandIndex=0;startIslandIndex<numElem;startIslandIndex = endIslandIndex)
+	{
+		int islandId = getUnionFind().getElement(startIslandIndex).m_id;
+
+
+	       bool islandSleeping = false;
+                
+                for (endIslandIndex = startIslandIndex;(endIslandIndex<numElem) && (getUnionFind().getElement(endIslandIndex).m_id == islandId);endIslandIndex++)
+                {
+                        int i = getUnionFind().getElement(endIslandIndex).m_sz;
+                        btCollisionObject* colObj0 = collisionObjects[i];
+						m_islandBodies.push_back(colObj0);
+                        if (!colObj0->isActive())
+                                islandSleeping = true;
+                }
+                
+
+		//find the accompanying contact manifold for this islandId
+		int numIslandManifolds = 0;
+		btPersistentManifold** startManifold = 0;
+
+		if (startManifoldIndex<numManifolds)
+		{
+			int curIslandId = getIslandId(m_islandmanifold[startManifoldIndex]);
+			if (curIslandId == islandId)
+			{
+				startManifold = &m_islandmanifold[startManifoldIndex];
 			
-			if (numIslandManifolds)
-			{
-				startManifoldIndex = endManifoldIndex;
-			}
-
-			m_islandBodies.resize(0);
-		}
-	} // else if(!splitIslands) 
-
-}
+				for (endManifoldIndex = startManifoldIndex+1;(endManifoldIndex<numManifolds) && (islandId == getIslandId(m_islandmanifold[endManifoldIndex]));endManifoldIndex++)
+				{
+
+				}
+				/// Process the actual simulation, only if not sleeping/deactivated
+				numIslandManifolds = endManifoldIndex-startManifoldIndex;
+			}
+
+		}
+
+		if (!islandSleeping)
+		{
+			callback->ProcessIsland(&m_islandBodies[0],m_islandBodies.size(),startManifold,numIslandManifolds, islandId);
+//			printf("Island callback of size:%d bodies, %d manifolds\n",islandBodies.size(),numIslandManifolds);
+		}
+		
+		if (numIslandManifolds)
+		{
+			startManifoldIndex = endManifoldIndex;
+		}
+
+		m_islandBodies.resize(0);
+	}
+#endif //SPLIT_ISLANDS
+
+
+}
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btSimulationIslandManager.h	(revision 2908)
@@ -36,5 +36,4 @@
 	btAlignedObjectArray<btCollisionObject* >  m_islandBodies;
 	
-	bool m_splitIslands;
 	
 public:
@@ -67,13 +66,4 @@
 	void buildIslands(btDispatcher* dispatcher,btCollisionWorld* colWorld);
 
-	bool getSplitIslands()
-	{
-		return m_splitIslands;
-	}
-	void setSplitIslands(bool doSplitIslands)
-	{
-		m_splitIslands = doSplitIslands;
-	}
-
 };
 
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp	(revision 2908)
@@ -79,5 +79,5 @@
 
 	///point on A (worldspace)
-	///btVector3 pos0 = col0->getWorldTransform().getOrigin() - radius0 * normalOnSurfaceB;
+	btVector3 pos0 = col0->getWorldTransform().getOrigin() - radius0 * normalOnSurfaceB;
 	///point on B (worldspace)
 	btVector3 pos1 = col1->getWorldTransform().getOrigin() + radius1* normalOnSurfaceB;
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btUnionFind.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btUnionFind.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btUnionFind.cpp	(revision 2908)
@@ -15,4 +15,6 @@
 
 #include "btUnionFind.h"
+#include <assert.h>
+
 
 
Index: code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btUnionFind.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btUnionFind.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/CollisionDispatch/btUnionFind.h	(revision 2908)
@@ -99,6 +99,6 @@
 		int find(int x)
 		{ 
-			//btAssert(x < m_N);
-			//btAssert(x >= 0);
+			//assert(x < m_N);
+			//assert(x >= 0);
 
 			while (x != m_elements[x].m_id) 
@@ -111,6 +111,6 @@
 		#endif //
 				x = m_elements[x].m_id;
-				//btAssert(x < m_N);
-				//btAssert(x >= 0);
+				//assert(x < m_N);
+				//assert(x >= 0);
 
 			}
