예제 #1
0
		public btContinuousConvexCollision( btConvexShape convexA, btStaticPlaneShape plane )
		{
			m_simplexSolver = ( null );
			m_penetrationDepthSolver = ( null );
			m_convexA = ( convexA ); m_convexB1 = ( null ); m_planeShape = ( plane );
		}
		// pass null to use default construction info
		public btDefaultCollisionConfiguration( btDefaultCollisionConstructionInfo constructionInfo )
		//btDefaultCollisionConfiguration(btStackAlloc*	stackAlloc,btPoolAllocator*	persistentManifoldPool,btPoolAllocator*	collisionAlgorithmPool)
		{
			if( constructionInfo == null )
				constructionInfo = new btDefaultCollisionConstructionInfo();

			m_simplexSolver = BulletGlobals.VoronoiSimplexSolverPool.Get();

#if !REMOVE_OBSOLETE_SOLVER
			if( constructionInfo.m_useEpaPenetrationAlgorithm )
#endif
			{
				m_pdSolver = BulletGlobals.GjkEpaPenetrationDepthSolverPool.Get();
			}
#if !REMOVE_OBSOLETE_SOLVER
			else
			{
				mem = btAlignedAlloc( sizeof( btMinkowskiPenetrationDepthSolver ), 16 );
				m_pdSolver = 
					new btMinkowskiPenetrationDepthSolver;
			}
#endif

			//default CreationFunctions, filling the m_doubleDispatch table
			m_convexConvexCreateFunc = new btConvexConvexAlgorithm.CreateFunc( m_simplexSolver, m_pdSolver );
			m_convexConcaveCreateFunc = new btConvexConcaveCollisionAlgorithm.CreateFunc();
			m_swappedConvexConcaveCreateFunc = new btConvexConcaveCollisionAlgorithm.SwappedCreateFunc();
			m_compoundCreateFunc = new btCompoundCollisionAlgorithm.CreateFunc();

			m_compoundCompoundCreateFunc = new btCompoundCompoundCollisionAlgorithm.CreateFunc();

			m_swappedCompoundCreateFunc = new btCompoundCollisionAlgorithm.SwappedCreateFunc();
			m_emptyCreateFunc = new btEmptyAlgorithm.CreateFunc();

			m_sphereSphereCF = new btSphereSphereCollisionAlgorithm.CreateFunc();
#if USE_BUGGY_SPHERE_BOX_ALGORITHM
			m_sphereBoxCF = new(mem) btSphereBoxCollisionAlgorithm.CreateFunc;
			m_boxSphereCF = new (mem)btSphereBoxCollisionAlgorithm.CreateFunc;
			m_boxSphereCF.m_swapped = true;
#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM

			m_sphereTriangleCF = new btSphereTriangleCollisionAlgorithm.CreateFunc();
			m_triangleSphereCF = new btSphereTriangleCollisionAlgorithm.CreateFunc();
			m_triangleSphereCF.m_swapped = true;

			m_boxBoxCF = new btBoxBoxCollisionAlgorithm.CreateFunc();

			//convex versus plane
			m_convexPlaneCF = new  btConvexPlaneCollisionAlgorithm.CreateFunc();
			m_planeConvexCF = new  btConvexPlaneCollisionAlgorithm.CreateFunc();
			m_planeConvexCF.m_swapped = true;

			///calculate maximum element size, big enough to fit any collision algorithm in the memory pool
			/*
			int maxSize = sizeof( btConvexConvexAlgorithm );
			int maxSize2 = sizeof( btConvexConcaveCollisionAlgorithm );
			int maxSize3 = sizeof( btCompoundCollisionAlgorithm );
			int maxSize4 = sizeof( btCompoundCompoundCollisionAlgorithm );

			int collisionAlgorithmMaxElementSize = btScalar.btMax( maxSize, constructionInfo.m_customCollisionAlgorithmMaxElementSize );
			collisionAlgorithmMaxElementSize = btScalar.btMax( collisionAlgorithmMaxElementSize, maxSize2 );
			collisionAlgorithmMaxElementSize = btScalar.btMax( collisionAlgorithmMaxElementSize, maxSize3 );
			collisionAlgorithmMaxElementSize = btScalar.btMax( collisionAlgorithmMaxElementSize, maxSize4 );
			*/

			/*
			if( constructionInfo.m_persistentManifoldPool )
			{
				m_ownsPersistentManifoldPool = false;
				m_persistentManifoldPool = constructionInfo.m_persistentManifoldPool;
			}
			else
			{
				m_ownsPersistentManifoldPool = true;
				object mem = btAlignedAlloc( sizeof( btPoolAllocator ), 16 );
				m_persistentManifoldPool = new  btPoolAllocator( sizeof( btPersistentManifold ), constructionInfo.m_defaultMaxPersistentManifoldPoolSize );
			}

			if( constructionInfo.m_collisionAlgorithmPool )
			{
				m_ownsCollisionAlgorithmPool = false;
				m_collisionAlgorithmPool = constructionInfo.m_collisionAlgorithmPool;
			}
			else
			{
				m_ownsCollisionAlgorithmPool = true;
				object mem = btAlignedAlloc( sizeof( btPoolAllocator ), 16 );
				m_collisionAlgorithmPool = new btPoolAllocator( collisionAlgorithmMaxElementSize, constructionInfo.m_defaultMaxCollisionAlgorithmPoolSize );
			}
			*/

		}
예제 #3
0
		internal void Initialize( btConvexShape convexA, btStaticPlaneShape plane )
		{
			m_simplexSolver = ( null );
			m_penetrationDepthSolver = ( null );
			m_convexA = ( convexA ); m_convexB1 = ( null ); m_planeShape = ( plane );
		}
예제 #4
0
		internal void Initialize( btConvexShape convexA, btConvexShape convexB, btSimplexSolverInterface simplexSolver, btConvexPenetrationDepthSolver penetrationDepthSolver )
		{
			m_simplexSolver = ( simplexSolver );
			m_penetrationDepthSolver = ( penetrationDepthSolver );
			m_convexA = ( convexA ); m_convexB1 = ( convexB ); m_planeShape = null;
		}
예제 #5
0
		public void Initialize( btPersistentManifold mf, btCollisionAlgorithmConstructionInfo ci, btCollisionObjectWrapper body0Wrap, btCollisionObjectWrapper body1Wrap, btSimplexSolverInterface simplexSolver, btConvexPenetrationDepthSolver pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold )
		{
			base.Initialize( ci, body0Wrap, body1Wrap );
			m_simplexSolver = ( simplexSolver );
			m_pdSolver = ( pdSolver );
			m_ownManifold = ( false );
			m_manifoldPtr = ( mf );
			m_lowLevelOfDetail = ( false );
#if USE_SEPDISTANCE_UTIL2
m_sepDistance((static_cast<btConvexShape*>(body0.getCollisionShape())).getAngularMotionDisc(),
			  (static_cast<btConvexShape*>(body1.getCollisionShape())).getAngularMotionDisc()),
#endif
			m_numPerturbationIterations = ( numPerturbationIterations );
			m_minimumPointsPerturbationThreshold = ( minimumPointsPerturbationThreshold );
		}
예제 #6
0
			internal CreateFunc( btSimplexSolverInterface simplexSolver, btConvexPenetrationDepthSolver pdSolver )
			{
				m_numPerturbationIterations = 0;
				m_minimumPointsPerturbationThreshold = 3;
				m_simplexSolver = simplexSolver;
				m_pdSolver = pdSolver;
			}
예제 #7
0
		///cache separating vector to speedup collision detection
		internal override void Cleanup()
		{
			if( m_ownManifold )
				m_dispatcher.releaseManifold( m_manifoldPtr );

			m_simplexSolver = null;
			m_pdSolver = null;
			m_manifoldPtr = null;
		}
예제 #8
0
		internal void Initialize( btConvexShape objectA, btConvexShape objectB, btSimplexSolverInterface simplexSolver
			, btConvexPenetrationDepthSolver penetrationDepthSolver )
		{
			m_cachedSeparatingAxis = btVector3.yAxis;
			m_penetrationDepthSolver = ( penetrationDepthSolver );
			m_simplexSolver = ( simplexSolver );
			m_minkowskiA = ( objectA );
			m_minkowskiB = ( objectB );
			m_shapeTypeA = ( objectA.getShapeType() );
			m_shapeTypeB = ( objectB.getShapeType() );
			m_marginA = ( objectA.getMargin() );
			m_marginB = ( objectB.getMargin() );
			m_ignoreMargin = ( false );
			m_lastUsedMethod = ( -1 );
			m_catchDegeneracies = ( 1 );
			m_fixContactNormalDirection = ( 1 );
		}
예제 #9
0
		internal void setPenetrationDepthSolver( btConvexPenetrationDepthSolver penetrationDepthSolver )
		{
			m_penetrationDepthSolver = penetrationDepthSolver;
		}