Collision force calculation using Bullet Physics

Hello everyone,

I am trying to calculate collision forces using the PhysicsCollisionEvent class [1].
This class has a method called getAppliedImpulse() which I assume it returns the impulse of the collision and a method called getLifeTime() which I assume returns the time of the collision (or the number of frames). Could you please confirm if this is the behavior of the 2 methods? I could not find this in the documentation.
In this case, if we know the know the impulse and the total time of the collision then, we can calculate the average force as follows:
J = Favg * deltaT => Favg = J / deltaT
Where J is the impulse returned by getAppliedImpulse(), deltaT is the total time of the collision returned by getLifeTime() and Favg is the average force of the collision.
Please correct me if I am wrong.


1 Like

Your assumptions are roughly correct, but perhaps the situation is more complicated than you realize. For a good intro to game physics, see Allen Chou’s tutorials.

Lifetime is measured in physics ticks. Due to margins, it may include some frames when the bodies weren’t actually in contact. A contact manifold may consist of up to 4 points. If there are multiple points in a contact manifold, they might have different lifetimes.

The applied impulse is always non-negative and is recalculated for each physics tick. If there are multiple contact points in the manifold, they might have different impulses.

To calculate a force, I suggest summing impulses across all relevant contact points and dividing by the physics timestep. Or it might be easier to look at velocity changes between timesteps and work backwards from there.

If you’re using jme3-jbullet, you can study the JBullet code that calculates lifetime and applied impulse. Start with “” and “”:

If you’re using jme3-bullet or Minie, then the computations are done in C++, but the code is doubtless very similar. (I can point you to it if you specify which library and version you’re using.)

Edit: according to the Minie documentation, getAppliedImpulse() returns the impulse calculated during the previous timestep, or zero if the warmstart bit is cleared in the solver mode. I’m unsure whether those caveats also apply to the jme-jbullet library.

1 Like