Anti tunneling by Motion Clamping
From Physics Simulation Wiki
Bullet 2.72 re-enables CCD based motion clamping. It lets the developer enable clamping of motion if the motion per simulation step exceeds a given threshold. This feature works on a per-object basis.
- CCD motion clamping activates for convex objects that exceed a (squared to avoid taking square roots) velocity threshold. By default this threshold is zero, which means this feature is disabled for rigid bodies.
For a cube of size 1 try:
//enable CCD if the object moves more than 1 meter in one simulation frame body->setCcdMotionThreshold(1);
- CCD works on an embedded sphere of radius, make sure this radius is embedded inside the convex objects, preferably smaller: for an object of dimentions 1 meter, try
- There is no CCD motion clamping between pairs of objects that are in penetration or that share contact points. This is done to avoid objects getting stuck forever.
- The Bullet demos can be used to try out motion clamping: try shooting a fast box in the latest demos (using . key or right mouse button) and increase the initial speed using '+' key, and watch the gNumClampedCcdMotions variable at the screen.