The program lets users spawn dominoes using a "builder domino" which moves around freely and can add a domino to the world as long as it is not intersecting any existing dominoes.
In ODE, I implemented this using a geom that had no body attached, and my collision callback would report any collisions with the builder domino, but not create a response.
In Bullet, I tried a few ways of implementing this with btGhostObject. The wiki page for "Collision Callbacks and Triggers" is pretty confusing. I copied the manifold-related code for btGhostObject, but it always returns 0 because the dominoes are colliding with the builder domino's ghost object, and being pushed away instead of just detected.
I then tried to use different collision flags, which stopped the dominoes from colliding with the builder, but it still would not detect collisions.
I also tried switching from btGhostObject to btPairCachingGhostObject. If anyone can explain the difference between them, that would help.
The wiki page I used didn't say how to create a ghost object. >:(
This is what I'm using currently:
Code: Select all
btPairCachingGhostObject * builderDomino;
/* some irrelevant code */
builderDomino = new btPairCachingGhostObject ();
builderDomino->setCollisionShape (dominoes.dominoCI->m_collisionShape);
builderDomino->setWorldTransform (dominoes.dominoCI->m_startWorldTransform);
world->addCollisionObject (builderDomino);
Then after each frame's world->stepSimulation, I run the code from the "btGhostObject" section in http://www.bulletphysics.org/mediawiki- ... d_Triggers, and print out the numPairs, which is always 0 because it seems to either collide with the dominoes and kick them out, or not collide at all.
What am I doing wrong?