Casting a ray to RigidBody with compound shape

darus
Posts: 2
Joined: Fri Jul 09, 2010 7:45 am

Casting a ray to RigidBody with compound shape

Post by darus »

Hello.

I have a question concerning btCollisionWorld's rayTest functionality. As far as I can understand, one can only have a btCollisionObject as a result. In my case, all world objects are actually btRigidBodies with a btCompoundShape containing several btConvexShapes. Is there a way to get the exact btConvexShape, that was hit by a ray?

Thank you!
MGB
Posts: 12
Joined: Wed Aug 24, 2005 8:54 pm
Location: uk

Re: Casting a ray to RigidBody with compound shape

Post by MGB »

I need this for my game too...
Looking at the code I see the required info in btCollisionWorld::LocalShapeInfo, and the comment:

///Currently, only btTriangleMeshShape is available, so it just contains triangleIndex and subpart

Damn. Looks like I didn't do my bullet homework well enough :(
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Casting a ray to RigidBody with compound shape

Post by Erwin Coumans »

The index member of LocalShapeInfo will contain the index of the child shape, also for btCompoundShape.

Thanks,
Erwin
MGB
Posts: 12
Joined: Wed Aug 24, 2005 8:54 pm
Location: uk

Re: Casting a ray to RigidBody with compound shape

Post by MGB »

Ahh, I was looking at m_shapePart for the shape index (always -1) - So the shape index is in m_triangleIndex eh! :roll:
Thanks.