Getting the impulse force from a collision?

Adversus
Posts: 19
Joined: Mon Nov 10, 2008 11:24 am

Getting the impulse force from a collision?

Post by Adversus »

I can get a list of btCollisionObject pairs that have collided but how do I find a way of getting the force of that collision?

Cheers.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Getting the impulse force from a collision?

Post by Erwin Coumans »

Each contact points stores the applied impulse (m_appliedImpulse).

You can check how to iterate over contact points (and manifolds) in Bullet/Demos/CollisionInterfaceDemo
Hope this helps,
Erwin
Adversus
Posts: 19
Joined: Mon Nov 10, 2008 11:24 am

Re: Getting the impulse force from a collision?

Post by Adversus »

Thanks Erwin,

Cheers, that worked.

However what's the best way to get the resultant collision normal?

I suspect I have to iterate over the points using getPositionWorldOnA and getPositionWorldOnB however I'm not sure.
justin
Posts: 8
Joined: Fri Mar 04, 2011 1:19 pm

Re: Getting the impulse force from a collision?

Post by justin »

hi, is getAppliedImpulse still working?
I used this method in my callbacks, but found this always returned 0.

I googled, and there's a saying in 2009 that this method is not used any more.
And I lookuped btPersistentManifold and found the impulse variables still exists.
So, I'm confused.

And my scenario using this method is to get the force (or impulse) between feet and ground when walking.
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Getting the impulse force from a collision?

Post by Flix »

justin wrote:is getAppliedImpulse still working?
Yes, as far as I know it's not available in the callbacks (e.g. "custom material callback"), but it works when you manually iterate the contact manifold for contact points.
almatea
Posts: 29
Joined: Mon Nov 02, 2009 10:15 am

Re: Getting the impulse force from a collision?

Post by almatea »

It would be wonderful to be possibly get impulse before collision process (inside gContactAddedCallback for example).
justin
Posts: 8
Joined: Fri Mar 04, 2011 1:19 pm

Re: Getting the impulse force from a collision?

Post by justin »

almatea wrote:It would be wonderful to be possibly get impulse before collision process (inside gContactAddedCallback for example).
Just the opposite in my opinion, because they belong to different stages.