I need to cast a ray towards a rigid body with a compound shape and retrieve the sub-collision shape that has been hit.
As explained in http://www.bulletphysics.org/Bullet/php ... =12&t=2527, I have to override RayResultCallback::addSingleResult and extract m_triangleIndex from the LocalRayResult passed as a parameter in order to obtain the index of the sub-shape. I did that and it works fine with "simple" compound shapes.
But in my application, I am dealing with recursive compound shapes:
- My rigid body has 1 compound shape (main object)
- This compound shape has n child shapes (sub-objects)
- Some of these child shapes might be compound shapes too and have m children of their own (convex parts of a mesh for example).
My issue is that when I cast a ray and retrieve the index of the shape that has been hit using the aforementioned method, I am given the index of a child of one of the lowest compound shapes in this tree (one of the m children). What I need is to know which child of the top compound shape has been hit ("which one of the n?").
Is there a way to do that? I see that LocalRayResult also contains a m_shapePart but it is always -1 and its meaning is not clear to me.
Thanks for your help
