Collision Response

anshul.bhardwaj
Posts: 28
Joined: Mon Aug 29, 2011 11:02 am

Collision Response

Post by anshul.bhardwaj »

Hi,
i tried to implement vehicle demo in my rendering engine and its working fine.
Now i am using btbvhtrianglemesh for walls, my vehicle is colliding with wall and behave perfectly like original practical vehicle but at the same time at very high speed its unstable (as after colliding its roll over). so i need to make vehicle stable.
But i don't know what physics should i need to update on collision detection and how?
and how can i get callback function with that particular wall objects?
Please help.
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm

Re: Collision Response

Post by Dr.Shepherd »

you may try collision callbacks, once you detect the collision between the vehicle and wall, a callback is triggered, then you decide whether or not to take some actions to stablize your car.
http://bulletphysics.org/mediawiki-1.5. ... d_Triggers

But actually, the cars will roll over if it is too fast...so why do you want to correct it? Just start over from a default position, that's what most racing games do!
anshul.bhardwaj
Posts: 28
Joined: Mon Aug 29, 2011 11:02 am

Re: Collision Response

Post by anshul.bhardwaj »

Dr.Shepherd wrote:you may try collision callbacks, once you detect the collision between the vehicle and wall, a callback is triggered, then you decide whether or not to take some actions to stablize your car.
Thanks for reply,
the car's tyres will always collided with the ground which is made up of bvhtrianglemesh and the vehicle's body will collide with the walls ( that are also made of bvhtrianglemesh). Then i don't think btpersistentmanifold will useful for my case, i think btghost object will be useful for me but its not that clear in explanation.
Do you have any documentation link for btghost object collision callback? OR is there any method to check collision callbacks using btpersistentmanifold?
Please help.
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm

Re: Collision Response

Post by Dr.Shepherd »

http://bulletphysics.org/mediawiki-1.5. ... d_Triggers

This is the tutorial link for ghostobject, but many people complained that it is out of date, because there is no "getOverlappingPairCache()" in the btGhostObject class.

But you can define the ghostObject as "btPairCachingGhostObject ", rather than "btGhostObject", the previous one is inherited from the latter one and has the function: "getOverlappingPairCache()".

Code: Select all

btManifoldArray   manifoldArray;
      btBroadphasePairArray& pairArray = ghostObject->getOverlappingPairCache()->getOverlappingPairArray();
      int numPairs = pairArray.size()
By this replacement, you can use the code in the tutorial example.

Actually I am writing a little tutorial on how to use GhostObject, it seems that we really need to make the documentation better.
anshul.bhardwaj
Posts: 28
Joined: Mon Aug 29, 2011 11:02 am

Re: Collision Response

Post by anshul.bhardwaj »

Thanks for your quick reply.
Well i read some old posts on ghostobject and now i am more confused than earlier.
i have a car which is implemented by ray cast method.

As given in the linkhttp://bulletphysics.org/mediawiki-1.5. ... d_Triggers, i tried contact manifold method and i am getting no collision detection for the tyres on ground. So if i want to know whether my car is on the road or on the grass, then how can i do that?

Secondly manifold method is giving me the contact point with walls, Do you have any link for iteration over the contact manifolds techniques because in my game there are different types of wall objects?

FYI: road and walls are of bvhtrianglemesh objects.

OR should i have to use ghostobjects?