I know how todo picking with LPD3DMESH objects but i am not sure how todo if for models directly drawn with DrawIndexPrimitve,how would you do it if D3DXIntersect takes a mesh object only?
Picking 3D Models thats drawn with DrawIndexPrimitive
Members - Reputation: 1638
Posted 28 April 2014 - 12:32 AM
Multiple choices, some may be not suitable for you depending on what you are really doing:
a) Make a D3DX mesh from the vertex/index data. You can create an empty mesh with D3DXCreateMesh() and then lock and fill its vertex and index buffer.
b) Use D3DXIntersectTri() to do intersection tests on individual triangles rather than the whole mesh/subset.
c) Use some other intersection method Physics engines will probably have functions for this (Havok certainly does, I'm not sure about the others.)