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..
How to detect that which collider in collide...
-
- Posts: 6
- Joined: Tue Nov 08, 2011 10:50 am
-
- Posts: 66
- Joined: Tue Mar 02, 2010 6:13 am
Re: How to detect that which collider in collide...
do a search for contacts callback on the forum
this has been answered many times before
this has been answered many times before

-
- Posts: 6
- Joined: Tue Nov 08, 2011 10:50 am
Re: How to detect that which collider in collide...
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...
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...
-
- Posts: 168
- Joined: Tue Jan 04, 2011 11:47 pm
Re: How to detect that which collider in collide...
Code: Select all
btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());
I suppose "Custom collision filtering" is another possible solution, but I didn't try it out. Anyone explains it here ?
-
- Posts: 66
- Joined: Tue Mar 02, 2010 6:13 am
Re: How to detect that which collider in collide...
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...
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...
-
- Posts: 6
- Joined: Tue Nov 08, 2011 10:50 am
Re: How to detect that which collider in collide...
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..???
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..???