This will be better, as it returns the closet vertex to the pick, rather than you having to click on one exactly.
Another cheaper way for mouse click, would be to project each vert into screen space(cameraproject) and then just do a quick distance check from screen coords to mouse coords...no idea if it'll be any quicker.
function pickedVertex() local sd#=999999,srf local vert,v,tri srf=pickedSurface() tri=pickedTriangle() for v=0 to 2 vert=triangleVertex(srf,tri) xd#=vertexX(srf,vert)-pickedX() yd#=vertexY(srf,vetr)-pickedY() zd#=vertexZ(srf,vert)-pickedZ() td#=sqr(xd*xd+yd*yd+zd*zd) if td<sd sd=td rVert=vert endif next return rVert end function
Another cheaper way for mouse click, would be to project each vert into screen space(cameraproject) and then just do a quick distance check from screen coords to mouse coords...no idea if it'll be any quicker.