1
\$\begingroup\$

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?

\$\endgroup\$
5
  • \$\begingroup\$ Whats wrong with the callbacks? It gives you the colliding rigidbody pointers. \$\endgroup\$ Commented Jan 12, 2012 at 16:49
  • \$\begingroup\$ Yes, but how you can guess which point is from which object? \$\endgroup\$
    – sebap123
    Commented Jan 12, 2012 at 16:54
  • \$\begingroup\$ Look at btManifoldPoint, the first parameter of ContactProcessedCallback \$\endgroup\$ Commented Jan 12, 2012 at 17:43
  • \$\begingroup\$ @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. \$\endgroup\$
    – sebap123
    Commented Jan 12, 2012 at 18:12
  • 2
    \$\begingroup\$ Please check the answer of the exact same question you have already asked. gamedev.stackexchange.com/questions/22442/… \$\endgroup\$
    – Gorky
    Commented Mar 3, 2012 at 16:07

1 Answer 1

4
\$\begingroup\$

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.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .