How to change impulse?

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

How to change impulse?

Post by anshul.bhardwaj »

In my case, a rigid body(car) is colliding with the wall, and by using contact callback method i am getting the collision callback, now i want to change the impulse that the wall applied to the car vehicle, Any suggestions will be of great help.
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm

Re: How to change impulse?

Post by Dr.Shepherd »

I think we can learn a lot from this post
http://www.bulletphysics.org/Bullet/php ... =17&t=3416

This should be done by setting up a custom collision callback
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm

Re: How to change impulse?

Post by Dr.Shepherd »

Sorry, but when I go through the that post today, I found you post the same question there. Hope @mi076@ could notice this post and reply.

Before that, we may discuss a bit.

What kind of methods did you try previously ?

If I am doing this, I may set up a custom collision callback, using:

Code: Select all

mBody->setCollisionFlags(mBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
So you can add up the custom callback to modify the collision response:

Code: Select all

gContactAddedCallback
Come on, mi076, we need your help !
anshul.bhardwaj
Posts: 28
Joined: Mon Aug 29, 2011 11:02 am

Re: How to change impulse?

Post by anshul.bhardwaj »

Dr.Shepherd wrote:Sorry, but when I go through the that post today, I found you post the same question there. Hope @mi076@ could notice this post and reply.

Before that, we may discuss a bit.

What kind of methods did you try previously ?

If I am doing this, I may set up a custom collision callback, using:

Code: Select all

mBody->setCollisionFlags(mBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
So you can add up the custom callback to modify the collision response:

Code: Select all

gContactAddedCallback
Come on, mi076, we need your help !
Thanks for reply,
Well using gContactAddedCallback method i am getting a callback when the car is colliding with the walls, but i don't know what parameters should be changed for proper response (as i am thinking of only impulse right now, may be there are other parameters too that should be changed ).
mi076
Posts: 144
Joined: Fri Aug 01, 2008 6:36 am
Location: Bonn, Germany

Re: How to change impulse?

Post by mi076 »

now i want to change the impulse that the wall applied to the car vehicle
it depends why... if it is too bouncy - may be adjusting restitution will be enough, or may be the vehicle itself have to be damped a little.. if you don't use any resistance forces you might add a little linear/angular damping..
for custom collision response look at (with example)
http://www.bulletphysics.org/Bullet/php ... f=9&t=6076
also, if the wall have to do something special, for example, apply very strong impulse or full damp you can use trigger - disable contact response and apply impulses yourself... there are many ways to achieve it..
User avatar
Dr.Shepherd
Posts: 168
Joined: Tue Jan 04, 2011 11:47 pm

Re: How to change impulse?

Post by Dr.Shepherd »

mi076 wrote: also, if the wall have to do something special, for example, apply very strong impulse or full damp you can use trigger - disable contact response and apply impulses yourself... there are many ways to achieve it..
Another question I want to ask by myself, if I added a "ContactAddedCallback", and set it as the custom callback, but all the objects, whose CollisionFlag has been set as CF_CUSTOM_MATERIAL_CALLBACK, will trigger the same custom callback, is it?

Is there a way to specify individual custom callback for individual object?
anshul.bhardwaj
Posts: 28
Joined: Mon Aug 29, 2011 11:02 am

Re: How to change impulse?

Post by anshul.bhardwaj »

Thanks for reply, i have few doubts..
mi076 wrote:it depends why... if it is too bouncy - may be adjusting restitution will be enough, or may be the vehicle itself have to be damped a little.. if you don't use any resistance forces you might add a little linear/angular damping..
for a plane its working good, but when the body collides with a straight wall ..due to high speed it start over turn in the air... i think its due to impulse by the wall on the car body( m i right? ).
Or there are some other forces which i should take care of ?.
also, if the wall have to do something special, for example, apply very strong impulse or full damp you can use trigger - disable contact response


Can i make custom callback of an object with a particular object?
and apply impulses yourself...there are many ways to achieve it..
Any example regarding that ?.
Thanks.