the funny thing is this runs fine on debug and only encounter this exception on release build.. before running the function, i usually check for pointers, the following conditions are at the start of the function, the exception is strangely cause by them as well:
Code: Select all
if(!pRigidBody)return;
if(!pDynamicsWorld)return;
if(!pDynamicsWorld->getBroadphase())return;
if(!pDynamicsWorld->getBroadphase()->getOverlappingPairCache())return; // hang here
i do get a value(pointer) for broadphase, and i assume my initialization code below has setup a broadphase unit. i am however unsure as to if there should be any "OverlappingPairCache" as this code is call when adding object into the scene, so the first time it is call, it would have NO object on the scene, would this be a problem? yet it work fine in debug...
following is my scene constructor (initialization) before calling the above troubled function:
Code: Select all
pCollisionConfiguration = new btDefaultCollisionConfiguration();
pDispatcher = new ColliderDispatcher(pCollisionConfiguration);
pDebugDraw = new ColliderDebugDraw();
pBroadphase= new btDbvtBroadphase();//new btSimpleBroadphase();
btVoronoiSimplexSolver* pSolveSimplex = new btVoronoiSimplexSolver();
btMinkowskiPenetrationDepthSolver* pSolvePd = new btMinkowskiPenetrationDepthSolver();
btConvex2dConvex2dAlgorithm::CreateFunc* pAlgoConvex2d = new btConvex2dConvex2dAlgorithm::CreateFunc(pSolveSimplex,pSolvePd);
btBox2dBox2dCollisionAlgorithm::CreateFunc* pAlgoBox2d = new btBox2dBox2dCollisionAlgorithm::CreateFunc();
pDispatcher->registerCollisionCreateFunc(CONVEX_2D_SHAPE_PROXYTYPE, CONVEX_2D_SHAPE_PROXYTYPE, pAlgoConvex2d);
pDispatcher->registerCollisionCreateFunc(BOX_2D_SHAPE_PROXYTYPE, CONVEX_2D_SHAPE_PROXYTYPE, pAlgoConvex2d);
pDispatcher->registerCollisionCreateFunc(CONVEX_2D_SHAPE_PROXYTYPE, BOX_2D_SHAPE_PROXYTYPE, pAlgoConvex2d);
pDispatcher->registerCollisionCreateFunc(BOX_2D_SHAPE_PROXYTYPE, BOX_2D_SHAPE_PROXYTYPE, pAlgoBox2d);
pSolveConst = new btSequentialImpulseConstraintSolver;
pDynamicsWorld = new btDiscreteDynamicsWorld(pDispatcher, pBroadphase, pSolveConst, pCollisionConfiguration);