The question seems to be simple, but it causes me a lot of headheaches, I'm trying to just detect who rigidbody is colliding with another one, and return an array with all collisions to android to be managed there, a simple callback, but i cant manage to get that info from the engine.
The last approach was this code from the bullets wiki:
But I keep getting "false collisions", obviously this is not what i prettend to do, I'be been reading a lot about bullet physics, but now i'm pretty stalled with this algorithm.LOGV("collisions detected");
int numManifolds = pDynamicsWorld->getDispatcher()->getNumManifolds();
logdi(numManifolds);
for (int i=0;i<numManifolds;i++)
{
btPersistentManifold* contactManifold = pDynamicsWorld->getDispatcher()->getManifoldByIndexInternal(i);
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
logdi((int)btRigidBody::upcast(obA));
logdi((int)btRigidBody::upcast(obB));
jclass bullet_clazz = env->GetObjectClass(thiz);
jmethodID bullet_resultSimulation_mid = env->GetMethodID(bullet_clazz, "collisionDetected", "(II)V");
env->CallVoidMethod(thiz, bullet_resultSimulation_mid, (int)btRigidBody::upcast(obA), (int)btRigidBody::upcast(obB));
}
I just want an array like collisions[] = (objA => rigidBody, objB => rigidBody).
Any help or pointer to document please?