Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp	(revision 2908)
@@ -20,4 +20,5 @@
 #include "btAxisSweep3.h"
 
+#include <assert.h>
 
 btAxisSweep3::btAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned short int maxHandles, btOverlappingPairCache* pairCache, bool disableRaycastAccelerator)
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btAxisSweep3.h	(revision 2908)
@@ -43,5 +43,4 @@
 public:
 	
- BT_DECLARE_ALIGNED_ALLOCATOR();
 
 	class Edge
@@ -140,5 +139,5 @@
 	SIMD_FORCE_INLINE Handle* getHandle(BP_FP_INT_TYPE index) const {return m_pHandles + index;}
 
-	virtual void resetPool(btDispatcher* dispatcher);
+	void resetPool();
 
 	void	processAllOverlappingPairs(btOverlapCallback* callback);
@@ -222,5 +221,5 @@
 
 	if (checkCardinality)
-		btAssert(numEdges == m_numHandles*2+1);
+		assert(numEdges == m_numHandles*2+1);
 }
 #endif //DEBUG_BROADPHASE
@@ -348,5 +347,5 @@
 	}
 
-	//btAssert(bounds.HasVolume());
+	//assert(bounds.HasVolume());
 
 	// init bounds
@@ -454,5 +453,5 @@
 BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::allocHandle()
 {
-	btAssert(m_firstFreeHandle);
+	assert(m_firstFreeHandle);
 
 	BP_FP_INT_TYPE handle = m_firstFreeHandle;
@@ -466,5 +465,5 @@
 void btAxisSweep3Internal<BP_FP_INT_TYPE>::freeHandle(BP_FP_INT_TYPE handle)
 {
-	btAssert(handle > 0 && handle < m_maxHandles);
+	assert(handle > 0 && handle < m_maxHandles);
 
 	getHandle(handle)->SetNextFree(m_firstFreeHandle);
@@ -589,5 +588,5 @@
 
 template <typename BP_FP_INT_TYPE>
-void btAxisSweep3Internal<BP_FP_INT_TYPE>::resetPool(btDispatcher* dispatcher)
+void btAxisSweep3Internal<BP_FP_INT_TYPE>::resetPool()
 {
 	if (m_numHandles == 0)
@@ -643,5 +642,4 @@
 			if (!isDuplicate)
 			{
-				///important to use an AABB test that is consistent with the broadphase
 				bool hasOverlap = testAabbOverlap(pair.m_pProxy0,pair.m_pProxy1);
 
@@ -689,4 +687,8 @@
 	}
 
+
+
+	
+
 }
 
@@ -729,6 +731,6 @@
 void btAxisSweep3Internal<BP_FP_INT_TYPE>::updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher)
 {
-//	btAssert(bounds.IsFinite());
-	//btAssert(bounds.HasVolume());
+//	assert(bounds.IsFinite());
+	//assert(bounds.HasVolume());
 
 	Handle* pHandle = getHandle(handle);
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h	(revision 2908)
@@ -65,7 +65,4 @@
 	virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const =0;
 
-	///reset broadphase internal structures, to ensure determinism/reproducability
-	virtual void resetPool(btDispatcher* dispatcher) {};
-
 	virtual void	printStats() = 0;
 
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h	(revision 2908)
@@ -70,6 +70,5 @@
 
 	SOFTBODY_SHAPE_PROXYTYPE,
-	HFFLUID_SHAPE_PROXYTYPE,
-	HFFLUID_BUOYANT_CONVEX_SHAPE_PROXYTYPE,
+
 	INVALID_SHAPE_PROXYTYPE,
 
@@ -189,5 +188,5 @@
 
 		//keep them sorted, so the std::set operations work
-		if (proxy0.m_uniqueId < proxy1.m_uniqueId)
+		if (&proxy0 < &proxy1)
         { 
             m_pProxy0 = &proxy0; 
@@ -230,11 +229,6 @@
 		bool operator() ( const btBroadphasePair& a, const btBroadphasePair& b )
 		{
-			const int uidA0 = a.m_pProxy0 ? a.m_pProxy0->m_uniqueId : -1;
-			const int uidB0 = b.m_pProxy0 ? b.m_pProxy0->m_uniqueId : -1;
-			const int uidA1 = a.m_pProxy1 ? a.m_pProxy1->m_uniqueId : -1;
-			const int uidB1 = b.m_pProxy1 ? b.m_pProxy1->m_uniqueId : -1;
-
-			 return uidA0 > uidB0 || 
-				(a.m_pProxy0 == b.m_pProxy0 && uidA1 > uidB1) ||
+			 return a.m_pProxy0 > b.m_pProxy0 || 
+				(a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 > b.m_pProxy1) ||
 				(a.m_pProxy0 == b.m_pProxy0 && a.m_pProxy1 == b.m_pProxy1 && a.m_algorithm > b.m_algorithm); 
 		}
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvt.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvt.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvt.cpp	(revision 2908)
@@ -394,5 +394,5 @@
 }
 
-#if 0
+//
 static DBVT_INLINE btDbvtNode*	walkup(btDbvtNode* n,int count)
 {
@@ -400,5 +400,4 @@
 	return(n);
 }
-#endif
 
 //
@@ -425,12 +424,7 @@
 void			btDbvt::clear()
 {
-	if(m_root)	
-		recursedeletenode(this,m_root);
+	if(m_root)	recursedeletenode(this,m_root);
 	btAlignedFree(m_free);
 	m_free=0;
-	m_lkhd		=	-1;
-	m_stkStack.clear();
-	m_opath		=	0;
-	
 }
 
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvt.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvt.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvt.h	(revision 2908)
@@ -58,5 +58,5 @@
 
 //SSE gives errors on a MSVC 7.1
-#ifdef BT_USE_SSE
+#if (defined (WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_USE_DOUBLE_PRECISION))
 #define DBVT_SELECT_IMPL		DBVT_IMPL_SSE
 #define DBVT_MERGE_IMPL			DBVT_IMPL_SSE
@@ -83,5 +83,5 @@
 #define DBVT_PREFIX					template <typename T>
 #define DBVT_IPOLICY				T& policy
-#define DBVT_CHECKTYPE				static const ICollide&	typechecker=*(T*)1;(void)typechecker;
+#define DBVT_CHECKTYPE				static const ICollide&	typechecker=*(T*)0;
 #else
 #define	DBVT_VIRTUAL_DTOR(a)		virtual ~a() {}
@@ -147,5 +147,7 @@
 	DBVT_INLINE friend bool			Intersect(	const btDbvtAabbMm& a,
 		const btDbvtAabbMm& b);
-	
+	DBVT_INLINE friend bool			Intersect(	const btDbvtAabbMm& a,
+		const btDbvtAabbMm& b,
+		const btTransform& xform);
 	DBVT_INLINE friend bool			Intersect(	const btDbvtAabbMm& a,
 		const btVector3& b);
@@ -303,5 +305,5 @@
 		  const btDbvtNode* root1,
 		  DBVT_IPOLICY);
-#if 0
+
 	DBVT_PREFIX
 		void		collideTT(	const btDbvtNode* root0,
@@ -315,6 +317,4 @@
 		const btTransform& xform1,
 		DBVT_IPOLICY);
-#endif
-
 	DBVT_PREFIX
 		void		collideTV(	const btDbvtNode* root,
@@ -531,5 +531,19 @@
 }
 
-
+//
+DBVT_INLINE bool		Intersect(	const btDbvtAabbMm& a,
+								  const btDbvtAabbMm& b,
+								  const btTransform& xform)
+{
+	const btVector3		d0=xform*b.Center()-a.Center();
+	const btVector3		d1=d0*xform.getBasis();
+	btScalar			s0[2]={0,0};
+	btScalar			s1[2]={dot(xform.getOrigin(),d0),s1[0]};
+	a.AddSpan(d0,s0[0],s0[1]);
+	b.AddSpan(d1,s1[0],s1[1]);
+	if(s0[0]>(s1[1])) return(false);
+	if(s0[1]<(s1[0])) return(false);
+	return(true);
+}
 
 //
@@ -835,5 +849,5 @@
 }
 
-#if 0
+
 //
 DBVT_PREFIX
@@ -891,4 +905,5 @@
 		}
 }
+
 //
 DBVT_PREFIX
@@ -902,5 +917,4 @@
 	collideTT(root0,root1,xform,policy);
 }
-#endif 
 
 //
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp	(revision 2908)
@@ -101,6 +101,5 @@
 			btDbvtProxy*	pb=(btDbvtProxy*)nb->data;
 #if DBVT_BP_SORTPAIRS
-			if(pa->m_uniqueId>pb->m_uniqueId) 
-				btSwap(pa,pb);
+			if(pa>pb) btSwap(pa,pb);
 #endif
 			pbp->m_paircache->addOverlappingPair(pa,pb);
@@ -134,5 +133,7 @@
 	m_updates_done		=	0;
 	m_updates_ratio		=	0;
-	m_paircache			=	paircache? paircache	: new(btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16)) btHashedOverlappingPairCache();
+	m_paircache			=	paircache?
+paircache	:
+	new(btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16)) btHashedOverlappingPairCache();
 	m_gid				=	0;
 	m_pid				=	0;
@@ -210,20 +211,21 @@
 }
 
-struct	BroadphaseRayTester : btDbvt::ICollide
-{
-	btBroadphaseRayCallback& m_rayCallback;
-	BroadphaseRayTester(btBroadphaseRayCallback& orgCallback)
-		:m_rayCallback(orgCallback)
-	{
-	}
-	void					Process(const btDbvtNode* leaf)
-	{
-		btDbvtProxy*	proxy=(btDbvtProxy*)leaf->data;
-		m_rayCallback.process(proxy);
-	}
-};	
-
 void	btDbvtBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin,const btVector3& aabbMax)
 {
+
+	struct	BroadphaseRayTester : btDbvt::ICollide
+	{
+		btBroadphaseRayCallback& m_rayCallback;
+		BroadphaseRayTester(btBroadphaseRayCallback& orgCallback)
+			:m_rayCallback(orgCallback)
+		{
+		}
+		void					Process(const btDbvtNode* leaf)
+		{
+			btDbvtProxy*	proxy=(btDbvtProxy*)leaf->data;
+			m_rayCallback.process(proxy);
+		}
+	};	
+
 	BroadphaseRayTester callback(rayCallback);
 
@@ -340,79 +342,4 @@
 	}
 #endif
-
-	performDeferredRemoval(dispatcher);
-
-}
-
-void btDbvtBroadphase::performDeferredRemoval(btDispatcher* dispatcher)
-{
-
-	if (m_paircache->hasDeferredRemoval())
-	{
-
-		btBroadphasePairArray&	overlappingPairArray = m_paircache->getOverlappingPairArray();
-
-		//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
-		overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
-
-		int invalidPair = 0;
-
-		
-		int i;
-
-		btBroadphasePair previousPair;
-		previousPair.m_pProxy0 = 0;
-		previousPair.m_pProxy1 = 0;
-		previousPair.m_algorithm = 0;
-		
-		
-		for (i=0;i<overlappingPairArray.size();i++)
-		{
-		
-			btBroadphasePair& pair = overlappingPairArray[i];
-
-			bool isDuplicate = (pair == previousPair);
-
-			previousPair = pair;
-
-			bool needsRemoval = false;
-
-			if (!isDuplicate)
-			{
-				//important to perform AABB check that is consistent with the broadphase
-				btDbvtProxy*		pa=(btDbvtProxy*)pair.m_pProxy0;
-				btDbvtProxy*		pb=(btDbvtProxy*)pair.m_pProxy1;
-				bool hasOverlap = Intersect(pa->leaf->volume,pb->leaf->volume);
-
-				if (hasOverlap)
-				{
-					needsRemoval = false;
-				} else
-				{
-					needsRemoval = true;
-				}
-			} else
-			{
-				//remove duplicate
-				needsRemoval = true;
-				//should have no algorithm
-				btAssert(!pair.m_algorithm);
-			}
-			
-			if (needsRemoval)
-			{
-				m_paircache->cleanOverlappingPair(pair,dispatcher);
-
-				pair.m_pProxy0 = 0;
-				pair.m_pProxy1 = 0;
-				invalidPair++;
-			} 
-			
-		}
-
-		//perform a sort, to sort 'invalid' pairs to the end
-		overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
-		overlappingPairArray.resize(overlappingPairArray.size() - invalidPair);
-	}
 }
 
@@ -420,21 +347,4 @@
 void							btDbvtBroadphase::collide(btDispatcher* dispatcher)
 {
-	/*printf("---------------------------------------------------------\n");
-	printf("m_sets[0].m_leaves=%d\n",m_sets[0].m_leaves);
-	printf("m_sets[1].m_leaves=%d\n",m_sets[1].m_leaves);
-	printf("numPairs = %d\n",getOverlappingPairCache()->getNumOverlappingPairs());
-	{
-		int i;
-		for (i=0;i<getOverlappingPairCache()->getNumOverlappingPairs();i++)
-		{
-			printf("pair[%d]=(%d,%d),",i,getOverlappingPairCache()->getOverlappingPairArray()[i].m_pProxy0->getUid(),
-				getOverlappingPairCache()->getOverlappingPairArray()[i].m_pProxy1->getUid());
-		}
-		printf("\n");
-	}
-*/
-
-
-
 	SPC(m_profiling.m_total);
 	/* optimize				*/ 
@@ -492,9 +402,9 @@
 		if(pairs.size()>0)
 		{
-
-			int			ni=btMin(pairs.size(),btMax<int>(m_newpairs,(pairs.size()*m_cupdates)/100));
+			const int	ci=pairs.size();
+			int			ni=btMin(ci,btMax<int>(m_newpairs,(ci*m_cupdates)/100));
 			for(int i=0;i<ni;++i)
 			{
-				btBroadphasePair&	p=pairs[(m_cid+i)%pairs.size()];
+				btBroadphasePair&	p=pairs[(m_cid+i)%ci];
 				btDbvtProxy*		pa=(btDbvtProxy*)p.m_pProxy0;
 				btDbvtProxy*		pb=(btDbvtProxy*)p.m_pProxy1;
@@ -502,6 +412,5 @@
 				{
 #if DBVT_BP_SORTPAIRS
-					if(pa->m_uniqueId>pb->m_uniqueId) 
-						btSwap(pa,pb);
+					if(pa>pb) btSwap(pa,pb);
 #endif
 					m_paircache->removeOverlappingPair(pa,pb,dispatcher);
@@ -558,37 +467,4 @@
 	aabbMin=bounds.Mins();
 	aabbMax=bounds.Maxs();
-}
-
-void btDbvtBroadphase::resetPool(btDispatcher* dispatcher)
-{
-	
-	int totalObjects = m_sets[0].m_leaves + m_sets[1].m_leaves;
-	if (!totalObjects)
-	{
-		//reset internal dynamic tree data structures
-		m_sets[0].clear();
-		m_sets[1].clear();
-		
-		m_deferedcollide	=	false;
-		m_needcleanup		=	true;
-		m_prediction		=	1/(btScalar)2;
-		m_stageCurrent		=	0;
-		m_fixedleft			=	0;
-		m_fupdates			=	1;
-		m_dupdates			=	0;
-		m_cupdates			=	10;
-		m_newpairs			=	1;
-		m_updates_call		=	0;
-		m_updates_done		=	0;
-		m_updates_ratio		=	0;
-		
-		m_gid				=	0;
-		m_pid				=	0;
-		m_cid				=	0;
-		for(int i=0;i<=STAGECOUNT;++i)
-		{
-			m_stageRoots[i]=0;
-		}
-	}
 }
 
@@ -725,3 +601,2 @@
 #undef	SPC
 #endif
-
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h	(revision 2908)
@@ -25,5 +25,5 @@
 
 #define	DBVT_BP_PROFILE					0
-//#define DBVT_BP_SORTPAIRS				1
+#define DBVT_BP_SORTPAIRS				1
 #define DBVT_BP_PREVENTFALSEUPDATE		0
 #define DBVT_BP_ACCURATESLEEPING		0
@@ -115,11 +115,4 @@
 	void							printStats();
 	static void						benchmark(btBroadphaseInterface*);
-
-
-	void	performDeferredRemoval(btDispatcher* dispatcher);
-
-	///reset broadphase internal structures, to ensure determinism/reproducability
-	virtual void resetPool(btDispatcher* dispatcher);
-
 };
 
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp	(revision 2908)
@@ -483,7 +483,2 @@
 
 }
-
-void btMultiSapBroadphase::resetPool(btDispatcher* dispatcher)
-{
-	// not yet
-}
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h	(revision 2908)
@@ -144,7 +144,4 @@
 	void quicksort (btBroadphasePairArray& a, int lo, int hi);
 
-	///reset broadphase internal structures, to ensure determinism/reproducability
-	virtual void resetPool(btDispatcher* dispatcher);
-
 };
 
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp	(revision 2908)
@@ -20,5 +20,4 @@
 #include "btDispatcher.h"
 #include "btCollisionAlgorithm.h"
-#include "LinearMath/btAabbUtil2.h"
 
 #include <stdio.h>
@@ -137,6 +136,5 @@
 {
 	gFindPairs++;
-	if(proxy0->m_uniqueId>proxy1->m_uniqueId) 
-		btSwap(proxy0,proxy1);
+	if(proxy0>proxy1) btSwap(proxy0,proxy1);
 	int proxyId1 = proxy0->getUid();
 	int proxyId2 = proxy1->getUid();
@@ -214,6 +212,5 @@
 btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
 {
-	if(proxy0->m_uniqueId>proxy1->m_uniqueId) 
-		btSwap(proxy0,proxy1);
+	if(proxy0>proxy1) btSwap(proxy0,proxy1);
 	int proxyId1 = proxy0->getUid();
 	int proxyId2 = proxy1->getUid();
@@ -274,6 +271,5 @@
 {
 	gRemovePairs++;
-	if(proxy0->m_uniqueId>proxy1->m_uniqueId) 
-		btSwap(proxy0,proxy1);
+	if(proxy0>proxy1) btSwap(proxy0,proxy1);
 	int proxyId1 = proxy0->getUid();
 	int proxyId2 = proxy1->getUid();
@@ -397,33 +393,4 @@
 }
 
-void	btHashedOverlappingPairCache::sortOverlappingPairs(btDispatcher* dispatcher)
-{
-	///need to keep hashmap in sync with pair address, so rebuild all
-	btBroadphasePairArray tmpPairs;
-	int i;
-	for (i=0;i<m_overlappingPairArray.size();i++)
-	{
-		tmpPairs.push_back(m_overlappingPairArray[i]);
-	}
-
-	for (i=0;i<tmpPairs.size();i++)
-	{
-		removeOverlappingPair(tmpPairs[i].m_pProxy0,tmpPairs[i].m_pProxy1,dispatcher);
-	}
-	
-	for (i = 0; i < m_next.size(); i++)
-	{
-		m_next[i] = BT_NULL_PAIR;
-	}
-
-	tmpPairs.quickSort(btBroadphasePairSortPredicate());
-
-	for (i=0;i<tmpPairs.size();i++)
-	{
-		addOverlappingPair(tmpPairs[i].m_pProxy0,tmpPairs[i].m_pProxy1);
-	}
-
-	
-}
 
 
@@ -463,5 +430,5 @@
 {
 	//don't add overlap with own
-	btAssert(proxy0 != proxy1);
+	assert(proxy0 != proxy1);
 
 	if (!needsBroadphaseCollision(proxy0,proxy1))
@@ -494,5 +461,5 @@
 	if (findIndex < m_overlappingPairArray.size())
 	{
-		//btAssert(it != m_overlappingPairSet.end());
+		//assert(it != m_overlappingPairSet.end());
 		 btBroadphasePair* pair = &m_overlappingPairArray[findIndex];
 		return pair;
@@ -524,7 +491,6 @@
 		{
 			cleanOverlappingPair(*pair,dispatcher);
-			pair->m_pProxy0 = 0;
-			pair->m_pProxy1 = 0;
-			m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
+
+			m_overlappingPairArray.swap(i,m_overlappingPairArray.capacity()-1);
 			m_overlappingPairArray.pop_back();
 			gOverlappingPairs--;
@@ -626,8 +592,2 @@
 	processAllOverlappingPairs(&removeCallback,dispatcher);
 }
-
-void	btSortedOverlappingPairCache::sortOverlappingPairs(btDispatcher* dispatcher)
-{
-	//should already be sorted
-}
-
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h	(revision 2908)
@@ -84,7 +84,4 @@
 
 	virtual	void	setInternalGhostPairCallback(btOverlappingPairCallback* ghostPairCallback)=0;
-
-	virtual void	sortOverlappingPairs(btDispatcher* dispatcher) = 0;
-
 
 };
@@ -263,8 +260,5 @@
 	}
 
-	virtual void	sortOverlappingPairs(btDispatcher* dispatcher);
-	
-
-protected:
+public:
 	
 	btAlignedObjectArray<int>	m_hashTable;
@@ -376,6 +370,4 @@
 		}
 
-		virtual void	sortOverlappingPairs(btDispatcher* dispatcher);
-		
 
 };
@@ -456,7 +448,4 @@
 	}
 	
-	virtual void	sortOverlappingPairs(btDispatcher* dispatcher)
-	{
-	}
 
 
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp	(revision 2908)
@@ -470,4 +470,5 @@
 
 #ifdef RAYAABB2
+	btVector3 rayFrom = raySource;
 	btVector3 rayDir = (rayTarget-raySource);
 	rayDir.normalize ();
@@ -558,4 +559,5 @@
 
 #ifdef RAYAABB2
+	btVector3 rayFrom = raySource;
 	btVector3 rayDirection = (rayTarget-raySource);
 	rayDirection.normalize ();
@@ -816,5 +818,4 @@
 #include <new>
 
-#if 0
 //PCK: consts
 static const unsigned BVH_ALIGNMENT = 16;
@@ -822,5 +823,5 @@
 
 static const unsigned BVH_ALIGNMENT_BLOCKS = 2;
-#endif
+
 
 
@@ -1146,3 +1147,2 @@
 
 
-
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp	(revision 2908)
@@ -325,6 +325,4 @@
 }
 
-void	btSimpleBroadphase::resetPool(btDispatcher* dispatcher)
-{
-	//not yet
-}
+
+
Index: code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h
===================================================================
--- code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h	(revision 2907)
+++ code/branches/questsystem5/src/bullet/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h	(revision 2908)
@@ -109,7 +109,4 @@
 	}
 
-	///reset broadphase internal structures, to ensure determinism/reproducability
-	virtual void resetPool(btDispatcher* dispatcher);
-
 
 	void	validate();
