Page 1 of 1

How can i detect which Objects (ID's) collide in Bullet??

Posted: Tue Jul 14, 2009 11:01 pm
by dwells254lb43
Hello i have been using bullet for a decent amount of time now and i am currently wondering how i can detect which Objects / ID's collide. After a collision occured i want something simple to happen like it take damage etc. But i dont know which functions to call in order to check if a collision has occured, and how to manipulate the collided objects.

I have looked into the collision callbacks on : http://www.continuousphysics.com/mediaw ... d_Triggers

But i dont really understand the code to well, if anyone can help me i will appreciate it ^.^

Re: How can i detect which Objects (ID's) collide in Bullet??

Posted: Tue Jul 14, 2009 11:57 pm
by Erwin Coumans
The wiki link you provide tells that the best way to check for collisions between objects is
to iterate over all contact manifolds, and check if there are at least 1 contact point.

Have you tried that?
Thanks,
Erwin

Re: How can i detect which Objects (ID's) collide in Bullet??

Posted: Fri Jul 17, 2009 12:03 am
by dwells254lb43
Yes i understood that it iterated through every object and then when it finds a point of collision it will do the code below, however how do i get the ID's of those bodies? Do i use the void pointer? I noticed there was a void pointer in there and i was thinkin i could set it up to return the Id's of the objects that collide, but i was just wondering is there another way?

Re: How can i detect which Objects (ID's) collide in Bullet??

Posted: Wed Jul 22, 2009 2:01 am
by thloh85
There is a function called setUserPointer in btRigidBody(or somewhere if it's not there, I couldn't recall) AFAIK, therefore, use setUserPointer with whatever that identifies your body, and getUserPointer to check them.

Hope this helps