Get closest vertices to picked point on mesh

Hi there,
i’m working on something like a custom sculpting editor. The functionality i’m trying to achieve now is the dragging of an area of a mesh.

I’m trying to get nearest vertices of a picked point of a mesh.
One way (very messy) can be the calculation of distances of all vertices positions from the picked point, and then get only point inside a specified distance (radius).

There can be a more performant way to do something like this?

Thanks a lot

Hi @raffyjam welcome to the forum. Only on mobile so cannot do PG. You could do something similar to this ExtrudeShape does not seem to follow the path i give it - #3 by JohnK and you would have only three vertices to check distance to.

1 Like

Thanks a lot guys!
I’m now able to do some further step over. I found many useful patterns to explore right now.

My final goal is to drag an area (with an undefined number of vertex inside) by controlling the exact drag direction with some kind of advanced UX stuff. I thought at the left mouse button to drag, and while keep pressing it one can change the drag direction by pressing the right mouse button and change the inclination by moving a little arrow at the cursor point. During this interaction will be also necessary adding facets in right points to avoid bad smoothing. Something like a semplified and limited version of Zbrush. I know this will require mixing more patterns together.