Making sense of output collision data

Post Reply
dunedainrngr
Posts: 3
Joined: Thu Jul 02, 2015 9:17 pm

Making sense of output collision data

Post by dunedainrngr »

I am planning on using Bullet's collision detection within the framework of a separate dynamics code. However, I am having a little trouble making sense of the collision output data.

As a test, I wanted to check how well bullet will compare against itself with 2 primitive spheres and 2 trimesh spheres imported from STL files.

Using the importSTL demo as a starting point, I read in the triangle data and eventually used HACD to convert them into btCompoundShape.

When I collide two primitive spheres, I get exactly what I expect from the contact manifold. The normal points between the centers of the spheres and the "distance" of the contact is the length of the overlapping region (or alternatively the difference between the distance between the spheres and the sum of the radii).

When I collide the two compound spheres, things get much more complicated. First I get many manifolds, each with a single contact point. However, the number of manifolds varies depending on the orientation of the spheres (rotating the final btCompundShape). I expect that I should be able to somehow take these contact manifolds and combine them together to get back the same result as the two primitive spheres (with some small error due to the convex decomposition/mesh). As a starting point, I first tried just summing up the product of the contact "distance" and the contact "normal". The final result appears to always be in the right direction (pointing between the two sphere centers with some small error), but the length of this vector is much larger than it should be. The more contact manifolds generated, the larger the vector is.

So...here are my questions regarding this:
1. In the btCompoundShape case, do the multiple manifolds each represent one convex hull colliding with another (each on different shapes)?
2. Am I combining the contact information correctly? Perhaps there needs to be some sort of factor related to the number of manifolds (1/2*# of manifolds seems to get me close usually)?
3. Digging into how contact forces are applied, they appear to be applied along the contact normal for every manifold point with the force/impulse directly proportional to the penetration depth/distance, is that correct?

Thanks very much
Post Reply