contactTest: m_appliedImpulse is always 0

apanloco
Posts: 7
Joined: Wed Dec 29, 2010 12:08 am

contactTest: m_appliedImpulse is always 0

Post by apanloco »

I drop a ball on a table, and I want to trigger a sound. The amplitude of the sound should be relative to the magnitude of the impulse. So for collision detection i have added a contactTest for the ball. It correctly triggers for the collision, but m_appliedImpulse in the btManifoldPoint is always zero. The log gives me:

Code: Select all

[BallContactCallback:addSingleResult(292)] collisionType0: 2, collisionType1: 1, cp.distance: -0.067029
[BallContactCallback:addSingleResult(309)] cp.lifeTime: 0, cp.appliedImpulse: 0.000000, body0vel: (0.396354, 1.623162, -52.398472), body1vel: (0.000000, 0.000000, 0.000000)
[BallContactCallback:addSingleResult(321)] cp.normal: (-0.000002, 0.000002, 1.000000), cp.posA: (0.524337, 0.418708, -0.067029), cp.posB: (0.524336, 0.418709, -0.000000), cp.m_appliedImpulseLateral1: 0.000000, cp.m_appliedImpulseLateral2: 0.000000
[BallContactCallback:addSingleResult(326)] cp.m_contactCFM1: 0.000000, cp.m_contactCFM2: 0.000000, cp.m_contactMotion1: 0.000000, cp.m_contactMotion2: 0.000000
Why is it zero, and how can I retrieve it?

I guess I theoretically could calculate it with the two velocities and the normal, but since bullet certainly calculates this internally at some point, it should be retrievable I guess.

Using Bullet 2.77.

BR, apanloco
MonkeyTank
Posts: 10
Joined: Thu Oct 08, 2009 6:57 pm

Re: contactTest: m_appliedImpulse is always 0

Post by MonkeyTank »

I am having the same issue. This seemed to work in earlier versions of bullet. However, in 2.77 I am also getting an impulse of zero after a collision.
apanloco
Posts: 7
Joined: Wed Dec 29, 2010 12:08 am

Re: contactTest: m_appliedImpulse is always 0

Post by apanloco »

I temporarily solved it by switching to another collision detection mechanism. I now manually loop through each contact, using the first example in the wiki "Contact Information":
http://bulletphysics.org/mediawiki-1.5. ... d_Triggers

There the impulse is set properly.