Problems with collision tickCallback

O-san
Posts: 19
Joined: Mon May 11, 2009 8:46 am

Problems with collision tickCallback

Post by O-san »

I got a tickCallback to retrive which objects has collided (I use it to determine footstep sounds). It works fine except it doesn't catch all collisions. In some cases when my character is walking upstairs the callback doesn't report any collisions. Could it be because I use applyCentralForce to move my character around, and push it slightly up when it is walking on stairs? Is there a way to increase the resolution of the callback, or something?

Here is my tick callback (similar to the article):

Code: Select all

int numManifolds = world->getDispatcher()->getNumManifolds();
	for (int i=0;i<numManifolds;i++){
		btPersistentManifold* contactManifold = world->getDispatcher()->getManifoldByIndexInternal(i);
		btCollisionObject* ob1 = static_cast<btCollisionObject*>(contactManifold->getBody0());
		btCollisionObject* ob2 = static_cast<btCollisionObject*>(contactManifold->getBody1());

		int numContacts = contactManifold->getNumContacts();

		for (int j=0;j<numContacts;j++){
			btManifoldPoint& pt = contactManifold->getContactPoint(j);
			if(pt.m_lifeTime>0){
          // ... do sound stuff
Thank you for a great physics engine!