My objects collide, but bullet does not detect collision...

sancelot
Posts: 6
Joined: Thu Jun 07, 2012 12:49 pm

My objects collide, but bullet does not detect collision...

Post by sancelot »

Hi,

I am working on a 3D tube bending's simulation software.

I integrated bullet api for collision in my opengl app, using only btWorldCollision without dynamic.
Each objects are defined as CollideObject .

The position of objects are given to the collide objects retrieving the openGL matrix.

I used the debug drawer to watch if my objects were well settled, and everything is fine.

However the following code is used to find collisions , but no collision is found :-(
[syntax="c"]
physicalWorld->performDiscreteCollisionDetection();
//physicalWorld->debugDrawWorld();
///one way to draw all the contact points is iterating over contact manifolds in the dispatcher:

int numManifolds = physicalWorld->getDispatcher()->getNumManifolds();
for (int i=0;i<numManifolds;i++)
{
btPersistentManifold* contactManifold = physicalWorld->getDispatcher()->getManifoldByIndexInternal(i);
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
printf("collision !\n");
int numContacts = contactManifold->getNumContacts();
if (numContacts > 0)
return 1;
}
[/syntax]
Can somebody give me some tips ?
sancelot
Posts: 6
Joined: Thu Jun 07, 2012 12:49 pm

Re: My objects collide, but bullet does not detect collision

Post by sancelot »

Hi,
No answer... May be I did not provide enough informations, so I provided my Bullet cpp class file.

I use it as follow :

1) load trimeshes objects
2) compute and setup trimeshes position
3) display trimeshes in opengl view
4) retrieve matrix of each trimesh from opengl and provide it to the corresponding collide object
5) compute collision
6) go to step 2....


Regards,
Steph

BulletObject.cpp
You do not have the required permissions to view the files attached to this post.
sancelot
Posts: 6
Joined: Thu Jun 07, 2012 12:49 pm

Re: My objects collide, but bullet does not detect collision

Post by sancelot »