I am trying to grab the closest vertex to my mouse click using picking. I understand that the &t represents distance, but how can I get the distance of each vertex from the mouse click after converting it all to the correct worlds I am able to select the faces of the mesh, but am struggling on selecting the closest vertex.
UINT hitCount;
float u,v,t;
ID3D10Blob* allHits;
d3dxmesh->Intersect(&rayOrigin, &rayDir, &hitCount,
&PickedTriangle, &u, &v, &t, &allHits);
I know the vertex is going to be vertex[indices[PickedTriangle*3+0]] ..etc. So how can I get the distance from the click for each vertex in the triangle selected.