If I have a btRigidBody composed of several btCollisionShapes, is it possible to find which btCollisionShape a ray test hit?
At the moment I get back a btCollisionObject from the ray test (btCollisionWorld::RayResultCallback) which I can upcast to a btRigidyBody, which has a btCompoundShape (see below)
Code: Select all
btCompoundShape* cs = (btCompoundShape*)result.m_collisionObject->getCollisionShape();
Code: Select all
int child_count = cs->getNumChildShapes();
for ( int c = 0; c < child_count; ++c )
{
btCollisionShape* shape = cs->getChildShape( c );
// something interesting
}
Apologies if I'm missing something incredibly obvious!
Thanks very much for your time!
Tom