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 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?

share|improve this question
    
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
    
Please check the answer of the exact same question you have already asked. gamedev.stackexchange.com/questions/22442/… –  Gorky Mar 3 '12 at 16:07
add comment

1 Answer

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.

share|improve this answer
    
Welcome to GameDev SE! Thanks for your answer. –  Byte56 Mar 30 '12 at 14:42
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.