I'm experimenting with the bvhtree python module and am confused about the index attribute that's returned by find(). Assumption is that it's the vertex index but could be mistaken.
Also note that the documentation shows find_nearest() but the method is find() at the time of this writing
In the console with mathvis addon enabled, here's an example to test:
bv = bvhtree.BVHTree.FromObject(C.object, C.scene)
hit = bv.find(C.scene.cursor_location)[0]
index = C.active_object.data.vertices[bv.find(C.scene.cursor_location)[2]].co
but the hit and index don't match up as expected (would expect the vertex to be a little off but not across the shape). This is with a mesh object, no scale, no modifiers.
Supporting info is appreciated! Ideally I'd be able to get the vertex closest to a point with low overhead and easy syntax :)
find
andfind_nearest
and the api has been corrected to match the documentation. From 2.77BVHTree.find_nearest
will need to be used. $\endgroup$