Hey Guys! I found it for real now! It was not as hard as I thought it would be...
I made a little function that does it.. Works like a charm! What you do is give it the X and Y coordinates and the mesh and it tells you if the (x,y) is over your mesh... If you want you could call ClosestHit.Dist to see how far your mesh is from the screen.
Here is the function
'Determines if an (x,y) coordinate [could be of your mouse] in screen space is over a mesh
Function DoesMouseHitMesh(ByVal meshAs mesh, ByVal x As Single, ByVal y As Single) As Boolean
Dim viewport As Viewport
Dim world As Matrix
Dim proj As Matrix
Dim view As Matrix
Dim vIn As Vector3, vNear As Vector3, vFar As Vector3, vDir As Vector3
Dim ClosestHit As IntersectInformation
viewport = device.Viewport
world = device.Transform.World 'Now here you have to remember to get the world matrix that will be used on your mesh...
proj = device.Transform.Projection
view = device.Transform.View
vIn.X = x : vIn.Y = y
'Compute point on Near Clip plane at cursor
vIn.Z = 0
vNear = Microsoft.DirectX.Vector3.Unproject(vIn, viewport, proj, view, world)
'compute point on far clip plane at cursor
vIn.Z = 1
vFar = Microsoft.DirectX.Vector3.Unproject(vIn, viewport, proj, view, world)
'Comput direction vector
vDir = Microsoft.DirectX.Vector3.Subtract(vFar, vNear)
If mesh.Intersect(vNear, vDir, ClosestHit) = True Then
Return True
End If
End Function
It works GRATE men!
Later! Tell me if you need help in using it or dont understnad somthing...