# Detect two specific objects collision with bullet physics

I have got some problem with defining collision between objects in my game using bullet physics.

I know that objects are colliding with each other simultaneously and I don't have to do anything more. However I need to be noticed when one object collides with one of the rest.

It is quite awkward written so I will tell what I want to achive. I have got ball which hits wall from tubes. Everything is on the floor. When ball hits wall some fragments fall down to infinity. So I have got bellow floor btStaticPlaneShape. This is place where most of objects is stoping and then I can start another action. But not all of them.

So I've been trying to use function checkCollideWith but it isn't good method as it was said in reference and wiki.

So I've checked method described in wiki http://bulletphysics.org/mediawiki-1.5.8/index.php/Collision_Callbacks_and_Triggers called contact information. This isn't good method either because it is extremly hard to identify what is what when colliding. You have to also remember that ball is almost all the time colliding with something - floor, wall or eart level.

So is there any other method to check what is colliding with what?

• Whats wrong with the callbacks? It gives you the colliding rigidbody pointers. – Maik Semder Jan 12 '12 at 16:49
• Yes, but how you can guess which point is from which object? – sebap123 Jan 12 '12 at 16:54
• Look at btManifoldPoint, the first parameter of ContactProcessedCallback – Maik Semder Jan 12 '12 at 17:43
• @Maik sorry but I don't get it. The first two parameters of btMainfoldPoint are vectors of points possition. I don't know what you mean. – sebap123 Jan 12 '12 at 18:12
checkCollideWith isn't for dynamic collisions, it is used to see if an object is set to collide with another, not to see if there's a collision.
Also, you can setUserPointer in your rigidbody to have a pointer to anything, be it your own class or not. with that, you can then check what-is-what when colliding by using getUserPointer on the two btCollisionObjects.