The reason that I'm trying to do this is: when a sphere is at the corner formed by two planes (like when on the edge of a cliff), I can use a contact added callback to find the normal of the triangle the sphere is colliding with. However, only one contact seems to be added, and its for the triangle that is handled first. I need to get the normal for the horizontal triangle, not the vertical triangle. By sorting the triangles by the Y component of their normal (descending), I am able to get this behavior for TriangleMeshShape, but obviously that won't work for BvhTriangleMeshShape.
simple diagram
Code: Select all
_____o <--- need to get normal for this top triangle from the contact
| <--- not the normal from this one
|