• Create Account

#ActualVoidAccess

Posted 27 March 2013 - 09:46 PM

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.

#2VoidAccess

Posted 27 March 2013 - 09:45 PM

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 vertices[indices[PickedTriangle*3+0]] ..etc. So how can I get the distance from the click for each vertex in the triangle selected.

#1VoidAccess

Posted 27 March 2013 - 09:44 PM

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 vertices[indices[mPickedTriangle*3+0]] ..etc. So how can I get the distance from the click for each vertex in the triangle selected.

PARTNERS