In issue2.png, the player runs to the left then he jumps. Upon landing, he gets stuck as can be seen in the image. Again, I think he's stuck between those two blocks, the red arrow is pointing towards where he's stuck. If he moves to the right, towards where the yellow arrow is pointing, he gets unstuck and can progress to the left afterwards.
Apparently the player's bounding box is penetrating the block, he has a Y coordinate of 10.6764. When I then press the right arrow, he gets unstuck and his Y coordinate becomes 10.6765. A block has a width of exactly 1, collision margin 0, mass 0. The character has mass 1 and collision margin set to 50 which I don't understand why it is not reflected in the bounding box, the bounding box clearly still has a width of 1. (actually 0.85, I want the char to fall through 1 width gaps so he must fit).
The two questions:
- why does the character get stuck in these cases?
- why doesn't setMargin do anything to my character's collision box?
Further info:
- the physics initialization code:
Code: Select all
mCollisionConfiguration.reset(new ::btDefaultCollisionConfiguration);
mDispatcher.reset(new btCollisionDispatcher(mCollisionConfiguration.get()));
mSimplex.reset(new btVoronoiSimplexSolver());
//mPdSolver.reset(new btMinkowskiPenetrationDepthSolver());
mPdSolver.reset(new btGjkEpaPenetrationDepthSolver());
mConvexAlgo2d.reset(new btConvex2dConvex2dAlgorithm::CreateFunc(mSimplex.get(), mPdSolver.get()));
mDispatcher->registerCollisionCreateFunc(CONVEX_2D_SHAPE_PROXYTYPE,CONVEX_2D_SHAPE_PROXYTYPE, mConvexAlgo2d.get());
mDispatcher->registerCollisionCreateFunc(BOX_2D_SHAPE_PROXYTYPE,CONVEX_2D_SHAPE_PROXYTYPE, mConvexAlgo2d.get());
mDispatcher->registerCollisionCreateFunc(CONVEX_2D_SHAPE_PROXYTYPE,BOX_2D_SHAPE_PROXYTYPE, mConvexAlgo2d.get());
mDispatcher->registerCollisionCreateFunc(BOX_2D_SHAPE_PROXYTYPE,BOX_2D_SHAPE_PROXYTYPE,new btBox2dBox2dCollisionAlgorithm::CreateFunc());
//mDispatcher->registerCollisionCreateFunc(BOX_2D_SHAPE_PROXYTYPE,BOX_2D_SHAPE_PROXYTYPE, mConvexAlgo2d.get());
mBroadphase.reset(new btDbvtBroadphase());
//m_broadphase = new btSimpleBroadphase();
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
mConstraintSolver.reset(new btSequentialImpulseConstraintSolver);
mDynamicsWorld.reset(new btDiscreteDynamicsWorld(
mDispatcher.get(),
mBroadphase.get(),
mConstraintSolver.get(),
mCollisionConfiguration.get()));
mDynamicsWorld->setGravity(kGravity);
I'm sorry if the issue has been tackled before, but I searched the forums and google and nothing came up. I initially tried to solve the issue by setting collision margin on my character, but that did nothing.
Thank you in advance for any help you can provide me!