Hi All
I am very new to Bullet and game programming. Please accept my apology if this is an obvious answer.
In the collision world, there are one static triangle mesh (mesh could be built from btTriangleMesh, btGImpactMeshShape or other mesh class) and a ray (just a start point, direction and magnitude).
I need to find out which triangles (inside the triangle mesh) the ray is currently contacting with. I understand that i can create a ClosestRayResultCallback object to obtain the point of contact in the world and the contact normal. Is there a direct way to obtain the triangle index? (i.e. it is hitting the 3rd triangle in your triangle index array??)
Thank you very much for you help.
Brian
How to obtain the current contact triangle(s) index?
-
briantsedesign
- Posts: 2
- Joined: Fri Mar 19, 2010 11:40 am
-
KulSeran
- Posts: 9
- Joined: Thu Dec 10, 2009 10:32 pm
Re: How to obtain the current contact triangle(s) index?
in your custom result callback, the "addSingleResult" function recieves a LocalRayResult.
The LocalRayResult::m_localShapeInfo, if it is non-NULL, will contain the triangle contact information.
The LocalRayResult::m_localShapeInfo, if it is non-NULL, will contain the triangle contact information.
-
briantsedesign
- Posts: 2
- Joined: Fri Mar 19, 2010 11:40 am
Re: How to obtain the current contact triangle(s) index?
Thanks very much for your help.
All working now using addSingleResult.
All working now using addSingleResult.