I observe permanent oscillation when dropping a fairly flat box (2 x 2 x 0.1) onto a plane at a slight (e.g 30 deg) angle. This appears to be caused by the box-plane collision code refusing to generating more than 4 contact points (
here). Specifically, once the box is entirely below the plane, only the 4 vertices at the lower end of the box are considered contact points. When the contact joint forces push that end of the box up, it creates a torque which rotates the box so that at the next time step the other end is now the lowest end and only its 4 vertices are contact points. The resulting contact joint forces rotate the box in the other direction and then the process repeats forever. If I change the code to allow contact points to be generated for *all* of the vertices that are below the plane, the problem goes away.
Is there a reason for the current limit of 4 contact points? Although it is certainly somewhat faster than evaluating all of the vertices, the existing short circuit means that the relevant code will not be run at all unless there is at least contact point.
Also, the 4 contact points that are currently returned aren't even guaranteed to be the 4 deepest points. They are computed such that they are all on the same face (
here), but, for example, in the case of a cube oriented such that it's diagonal is parallel to the plane's normal, the 4 lowest vertices are not on the same face.
If the current behavior is indeed undesirable, let me know if you'd like a PR which evaluates all of the vertices.
--Dean