problem understanding PxContactPairPoint::impulse value

Hello
I’d like to get the magnitude of the force when a contact occurs. AFAIK the unit of an impulse is N.s (Newton*second) but the value doesn’t change when I change the simulation’s time step.

pair<PxVec3,PxReal> getAverageContactPositionAndForce(const PxContactPair & pair)
{
	PxContactPairPoint * contacts=new PxContactPairPoint[pair.contactCount];
	pair.extractContacts(contacts,pair.contactCount*sizeof(PxContactPairPoint));

	PxVec3 position=PxVec3((PxReal)0.0f);

	PxReal force=(PxReal)0.0f;

	for (PxU16 i=0;i<pair.contactCount;i++)
	{
		position+=contacts[i].position;
		force+=contacts[i].impulse.magnitude();
	}

	delete [] contacts;

	position/=pair.contactCount;
	//force/=timeStep; to get a force (in Newton)

	return std::pair<PxVec3,PxReal>(position,force);
}

the value of the variable force (without time division) is always the same whatever the time step is … so I get a (very) different force value when I change the time step for a given scene.

I tried the time steps 1/60 and 1/30 and get approximately the same impulse’s magnitude but the second should be the double of the first, shouldn’t it ?

So what’s wrong in my understanding of the impulse value ? Thanks in advance

Hello,

Impulse describes the change in momentum that occurred. I’ll try to explain why I would expect the impulse to be independent of timestep.

Imagine a ball being dropped downwards in a vacuum from a height Y so that it falls and hits a flat plane. The velocity of the ball on impact with the plane is independent of timestep. This makes sense because in nature there is no timestep. In fact, the impact velocity only depends on initial velocity, gravitational acceleration and Y (the height). On impact the ball experiences an impulse so that it changes direction and now moves upwards instead of downwards. The upwards velocity immediately after the impact is -restitution*downwardsVelocity. The minus sign ensures that the ball’s velocity changes direction, while the restitution value (0 < restitution < 1) describes how much momentumis lost to the impact. In this simple case, the impulse is:

impulse = change in momentum = massdownardsVelocity - mass(-restitution* downwardsVelocity) = massdownwardsVelocity(1+restitution)

As you can see, this is independent of timestep.

Force, on the other hand, is the rate of change of momentum. As a consequence, force is certainly dependent on timestep.

Hope this helps,

Gordon

Hello gyeoman, your answer helps me very much. Thank you
So I use impulses instead of forces. =)