Reputation: 810
It is sad in its docs:
The btGhostObject can keep track of all objects that are overlapping By default, this overlap is based on the AABB This is useful for creating a character controller, collision sensors/triggers, explosions etc
Does it mean it is only AABB of its underlying mesh and so detects only collisions with AABB and not complex mesh structure?
Upvotes: 1
Views: 498
Reputation: 1193
As of 2024.04, grabbing the latest BT library version, I am able to create a btGhostObject with TriMesh shape, and detect collision between it, and other dynamic rigid bodies, by iterating over the manifolds in a tick callback function. In my case, that's all I needed to have trigger volumes in my scenes.
Upvotes: 0
Reputation: 10260
There is no difference for collision dispatcher between a ghost object and a rigid body: they behave the same way both in broad- and narrow-phase. If you iterate over dispatcher's manifold array, you'll see proper collisions with ghost objects. Documentation refers to the btGhostObject
internal overlapping objects cache accessible via getOverlappingObject(int index)
/ getNumOverlappingObjects()
methods. This cache is populated in the broadphase (thus obviously using only AABB), and you have to set the proper pair callback for this to work (world->getPairCache()->setInternalGhostPairCallback(new btGhostPairCallback);
). You can iterate over this cache in the post-tick and check for the actual collisions.
Upvotes: 3