PhysX3.2.4 Collision Callback

Hi,

I have a small question about the default behaviour of PhysX3.
I created a class that inherits from PxSimulationEventCallback because i wan’t to receive the OnTrigger and onContact notifications. I also attached this callback interface to the scene.

When i test this implementation with a trigger, everything works as expected. But for some reason the onContact callback isn’t triggered when 2 bodies collide. It could be that this behaviour is changed with PhysX3 because as far as i know this worked with PhysX2.

I also tested with a custom SimulationFilterShader with simple logic.

PxFilterFlags CustomSimulationFilterShader(
	PxFilterObjectAttributes attribute0, PxFilterData filterData0,
	PxFilterObjectAttributes attribute1, PxFilterData filterData1,
	PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize)
{
	if((attribute0 & PxFilterObjectFlags::eTRIGGER) != 0 || (attribute0 & PxFilterObjectFlags::eTRIGGER) != 0)
	{
		pairFlags = PxPairFlag::eTRIGGER_DEFAULT;
		return PxFilterFlags();
	}

	pairFlags = PxPairFlag::eCONTACT_DEFAULT;
	return PxFilterFlags();
}

And the pairFlags are set to PxPairFlags::eContact_Default, but the PxSimulationEvent-OnContact isn’t called. (But OnTrigger works).
First of all, is my logic correct? (pairFlags == eCONTACT_DEFAULT => call onContact (PxSimulationEvent))?

Then, i experimented with different flags and suddenly my onContact method was called, using this code:

PxFilterFlags CustomSimulationFilterShader(
	PxFilterObjectAttributes attribute0, PxFilterData filterData0,
	PxFilterObjectAttributes attribute1, PxFilterData filterData1,
	PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize)
{

	pairFlags = PxPairFlag::eTRIGGER_DEFAULT;
	return PxFilterFlags();
}

This called the onContact method. (2 bodies, not marked as triggers). I know this code is incorrect and can cause unexpected behaviour but it’s the only time that my onContact method was called. (Bodies didn’t collide anymore, because the pair is marked as triggers i guess).

Any advice on how i could successfully trigger the onContact ‘event’?

Found the problem (but it’s still a bit strange :s)

Adding the eNotify_Touch_Found flag to the pairFlags triggered the onContact callback on contact. It’s strange that this flag isn’t set in the PxDefaultSimulationFilterShader, because without it only the onTrigger callback is called.

And that’s strange, the documentation states that the eNotify_Touch_Found flag will call the contact or trigger report callback if one of those states are triggered. But why does the onTrigger callback work without this flag set???

Should this flag be set in the the DefaultSimulationFilterShader too???
Or is my logic about this tirgger-collision-callback system still a bit off??