Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to detect collisions between two objects, both btBoxShapes. One of them, I update by setting


I have implemented collision detection using the setInternalTickCallback, in which I do the following

int numManifolds = world->getDispatcher()->getNumManifolds();

for (int i=0;i< numManifolds;i++) {
btPersistentManifold* contactManifold = world->getDispatcher()->getManifoldByIndexInternal(i);
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
int numContacts = contactManifold->getNumContacts();
for (int j=0;j< numContacts;j++) {
btManifoldPoint& pt = contactManifold->getContactPoint(j);
if (pt.getDistance()<0.f) {
// Flag as collision

When I add the rigid bodies to the world, I disable deactivation and activate


I also have masks so that one will only collide with the other and vice versa

#define BIT(x) (1<<(x))

enum collisionTypes {

dynamicsWorld->addRigidBody(body1, COL_SHIP, COL_WALL);
dynamicsWorld->addRigidBody(body2, COL_WALL, COL_SHIP);

When I run bullet physics, I get a collision when I collide the two bodies (moving one towards the other) the first time. But after that I don't get anymore collisions. I am visualizing the bodies using their AAbb's (using getAAbb) and it seems like they should be colliding except I get 0 contacts. Any thoughts on why this could be happening? Since I am disabling deactivation I don't think they are sleeping and since I know their AAbb's I don't think bullet is moving them on collision.

share|improve this question
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.