Getting compound shape`s child shape on a ray cast.
-
- Posts: 9
- Joined: Tue May 10, 2016 1:42 am
Getting compound shape`s child shape on a ray cast.
If I have a compound shape and hit it using a ray trace, is it possible to know which child shape of the compound shape was hit?
-
- Posts: 9
- Joined: Tue May 10, 2016 1:42 am
Re: Getting compound shape`s child shape on a ray cast.
Nvm, figured it using this:
http://www.bulletphysics.org/Bullet/php ... ray#p37118
I subclassed btCollisionWorld::ClosestRayResultCallback and put a field to store an in that is the index of what I hit.
http://www.bulletphysics.org/Bullet/php ... ray#p37118
I subclassed btCollisionWorld::ClosestRayResultCallback and put a field to store an in that is the index of what I hit.
Re: Getting compound shape`s child shape on a ray cast.
Hey StephenLynx,
It seems that you put some effort into this! Why don't you make a pull request to change the original raycast classes so that this information gets available?
It seems that you put some effort into this! Why don't you make a pull request to change the original raycast classes so that this information gets available?
-
- Posts: 7
- Joined: Tue Apr 12, 2016 12:53 pm
Re: Getting compound shape`s child shape on a ray cast.
Hi, there's a rare case nullptr bug in the mod, which should be tested for before using. I shall check previous project later and confirm which...(plus hopefully edit post from previous username)StephenLynx wrote:Nvm, figured it using this:
http://www.bulletphysics.org/Bullet/php ... ray#p37118
I subclassed btCollisionWorld::ClosestRayResultCallback and put a field to store an in that is the index of what I hit.
EDIT: in btCollisionWorld.h addSingleResult(), use if (rayResult.m_localShapeInfo) m_childShapeID = ...
Re: Getting compound shape`s child shape on a ray cast.
StephenLynx, thank a lot, for putting the link! It works! (m_localShapeInfo->m_triangleIndex)