What is the difference between initialization: (wiki uses the first and the demo the second)
collisionWorld.getPairCache().setInternalGhostPairCallback(ghostPairCallback);
and
collisionWorld.getBroadphase().getOverlappingPairCache().setInternalGhostPairCallback(ghostPairCallback);
I have tried to set it up both ways but it does not seem to make any difference for what I want. I am not interested in any contact points/normals I only want the objects which collides with the ghost object, but I do not want AABB collisions I want the actual collisions were the shapes actually overlaps.
I also tried using both GhostObject and PairCachingGhostObject but I'm not sure the difference, neither worked for me though, both returns AABB collisions.
Below is how I set it up currently:
Code: Select all
collisionConfiguration = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfiguration);
broadphase = new btDbvtBroadphase();
solver = new btSequentialImpulseConstraintSolver();
collisionWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
((btDynamicsWorld)collisionWorld).setGravity(gravity);
ghostPairCallback = new btGhostPairCallback();
collisionWorld.getPairCache().setInternalGhostPairCallback(ghostPairCallback);
Code: Select all
ghostObject = new btPairCachingGhostObject();
ghostObject.setCollisionShape(skillInfo.shape);
ghostObject.setWorldTransform(worldTrans);
ghostObject.setCollisionFlags((short) btCollisionObject.CollisionFlags.CF_NO_CONTACT_RESPONSE);
world.collisionWorld.addCollisionObject(ghostObject,
(short) btBroadphaseProxy.CollisionFilterGroups.SensorTrigger,
(short) (btBroadphaseProxy.CollisionFilterGroups.AllFilter ^ btBroadphaseProxy.CollisionFilterGroups.SensorTrigger));
Code: Select all
for(int i=0;i<ghostObject.getNumOverlappingObjects();i++){
GameObject go = ((GameObject) ghostObject.getOverlappingObject(i).userData);
...
...
}