How to detect that which collider in collide...

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
sankalp
Posts: 6
Joined: Tue Nov 08, 2011 10:50 am

How to detect that which collider in collide...

Post by sankalp »

Hiii....
I am new in bullet physics. My project have a vehicle which collide with different colliders.
Is there any way to find out that vehicle is striking with which colliders for example colliding with road or colliding with side walls etc..

so please tell me how i find out that specific collider in bullet....

Thanks in advance..
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: How to detect that which collider in collide...

Post by majestik666 »

do a search for contacts callback on the forum
this has been answered many times before :)
sankalp
Posts: 6
Joined: Tue Nov 08, 2011 10:50 am

Re: How to detect that which collider in collide...

Post by sankalp »

Thanks for reply ...
i already use contact call back method but it gives only information that body of car is hit with collider...either it side collider or road collider...

i want to optimize it that it gives information when it hits with only side collider not when it hits with road or other collider...
Hope you understand my problem well...
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm
Contact:

Re: How to detect that which collider in collide...

Post by Dr.Shepherd »

Code: Select all

btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
What I do is to check which object it is.

I suppose "Custom collision filtering" is another possible solution, but I didn't try it out. Anyone explains it here ?
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: How to detect that which collider in collide...

Post by majestik666 »

you could also use the collision mask/group (can't remember the exact name)
and use it to determine what object the collider is.
Or you can also attach a name to the rigid body and check the name...
sankalp
Posts: 6
Joined: Tue Nov 08, 2011 10:50 am

Re: How to detect that which collider in collide...

Post by sankalp »

Thanks for reply.....
i assign user pointer to 2 bodies and check their collision in contactcall-back function with help of their user pointer...
this method solve my problem.....
is this proper method or not..???
Post Reply