Sunday 7 March 2010

Collision shapes


Until now, on pdEngine, there were three choices when it came to collision shapes: a box around the whole objects, a sphere around the whole object or an accurate triangle mesh. The first two do not produce accurate results for complex shapes, and the last being slow for physX to handle.
What I have been wanting to do for a while, and something I have now achieved, is rather than generate a bounding box around the whole mesh, generate one for each subset. I have also done this using spheres, although it's more academic and I can't see this type of bounding actually being used.
In the attached screenshot there are three objects of the same mesh, a biplane that comes with the DirectX SDK. The leftmost uses spheres, the middle uses boxes and the one on the right uses the mesh.
The trouble with this technique I have experienced is converting between the physX coordinate system and the Direct3D coordinate system, one of which is twice the other. At the moment, this only works for axis-aligned bounding boxes, so it is not very useful for some objects, but I shall experiment with alternatives.

No comments:

Post a Comment