Stability issue with btBvhTriangleMeshShape
Posted: Tue May 22, 2012 10:05 pm
We're using btBvhTriangleMeshShape for the static scene, but it's proving to yield stability issues (Bullet 2.80-rev2531).
Take a simple scene: a box for the ground (static), and a smaller dynamic box placed on top of it. Everything is stable when using btBoxShape on both. But if we replace the static ground to instead use an equivalent btBvhTriangleMeshShape with 6x2 triangles, the dynamic box is a little shaky.
We've enabled debug rendering, and tried to make sense of the difference. From what we gathered, the box-box case (stable) quickly ends up with 4 persistent contact points at each corner of the contact face. But in the trimesh-box case, we can see the 4 contact points changing all of the time, and not converging to the 4 corners of the dynamic box (which is always a btBoxShape).
We've tried to trace things deeper, and noticed that the trimesh-box case had flipped normals, but we believe this is only a side-effect of having different A and B objects in the manifold (which always stores m_normalWorldOnB). We've also found that trimesh-box collision ends up using the GJK algorithm, but we're not sure if it's a potential cause for the instability. We understand that the contact manifold will always drop one of the 4 contact points, but shouldn't GJK normally restore it?
We've tried disabling KEEP_DEEPEST_POINT (btPersistentManifold.cpp@115) as well as turned 4-point area calculation (btPersistentManifold.cpp@26, set to false), to no avail.
We're a bit surprised no one in the forums reported such instability when using btBvhTriangleMeshShape, so we're hoping something simple we might have missed... Does anyone have any suggestion?
Take a simple scene: a box for the ground (static), and a smaller dynamic box placed on top of it. Everything is stable when using btBoxShape on both. But if we replace the static ground to instead use an equivalent btBvhTriangleMeshShape with 6x2 triangles, the dynamic box is a little shaky.
We've enabled debug rendering, and tried to make sense of the difference. From what we gathered, the box-box case (stable) quickly ends up with 4 persistent contact points at each corner of the contact face. But in the trimesh-box case, we can see the 4 contact points changing all of the time, and not converging to the 4 corners of the dynamic box (which is always a btBoxShape).
We've tried to trace things deeper, and noticed that the trimesh-box case had flipped normals, but we believe this is only a side-effect of having different A and B objects in the manifold (which always stores m_normalWorldOnB). We've also found that trimesh-box collision ends up using the GJK algorithm, but we're not sure if it's a potential cause for the instability. We understand that the contact manifold will always drop one of the 4 contact points, but shouldn't GJK normally restore it?
We've tried disabling KEEP_DEEPEST_POINT (btPersistentManifold.cpp@115) as well as turned 4-point area calculation (btPersistentManifold.cpp@26, set to false), to no avail.
We're a bit surprised no one in the forums reported such instability when using btBvhTriangleMeshShape, so we're hoping something simple we might have missed... Does anyone have any suggestion?