Persistent Contact Manifold
Introduction
PhysX SDK 3.2 provides two types of collision detection:
- Default collision detection
The default collision detection system uses a mixture of SAT (Separating Axis Theorem) and distance-based collision detection to generate full contact manifolds. It generates all the potential contacts in one frame, so it lends itself better to stable stacking. This approach is stable for small contact offsets and rest offsets but may not generate the correct contact points when large offsets are used because it approximates the contact points in these situations by plane shifting.
- Persistent Contact Manifold (PCM)
PCM is a fully distance-based collision detection system, which uses the Gilbert-Johnson-Keerthi algorithm (GJK) and the Expanding Polytope Algorithm (EPA) to calculate one contact at the point of deepest penetration. It then uses an incremental method to build up a contact manifold by recycling contacts from past frames, accumulating up to four contacts per frame. This approach is quite efficient in terms of performance and memory. However, it can reduce stacking stability when simulating with large timesteps, tall stacks and small objects. As this approach is distance-based, it will generate the correct contact points for arbitrary contact offsets/rest offsets.
Note that PCM is under active development, and is not yet as mature as the default collision system.
Enabling the Persistent Contact Manifold
To enable PCM, set the flag in the PxSceneDesc::flags:
PxSceneDesc sceneDesc;
sceneDesc.flags |= PxSceneFlag::eENABLE_PCM;