I have a Kinematic platform (box) object and a btKinematicCharacterController object, both of which I can move around under user control.
If I move the character object so it collides with the stationary platform, the "recoverFromPenetration" function in the btKinematicCharacterController class handles the overlapping pair correctly and finds one contact point in the character/platform's overlapping pair manifold. The penetration recovery works as expected and the character steps up onto the platform and rests on its upper surface.
However, if the kinematic platform is moving and collides with the character, the character becomes embedded in the platform. This happens irrespective of whether the character is moving or stationary.
Looking into the "recoverFromPenetration" function in this second failing scenario, I see that the overlapping platform/character pair is being detected but that there are no contact points in the associated manifold and so no penetration recovery takes place.
I wondered if the problem related to collision groups, masks or collision object collision flags but trying different combinations, doesn't seem to affect things.
Looking through the forum, I see that folk sometimes mistakenly omit the step:
Code: Select all
physicsBroadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
I'm aware that the btKinematicCharacterController class is regarded as a little flaky but this issue seems to relate to straightforward collision detection rather than issues with the character controller itself.
Any ideas on where to focus my bug hunting would be much appreciated.
As an aside, how do the collision filter groups/masks relate to/interact with the collision object's collision flags?
As an example, btCollisionObject::CF_KINEMATIC_OBJECT = 2 whereas btBroadphaseProxy::KinematicFilter = 4, so I assume these don't interact, but I'm unclear on what the collision flag is used for.
Cheers.