HairyPlotterVertex RaycastVertex() { // This transform from GUI space to scene camera ray Ray r = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); Transform t = plotter.transform; // this for position gizmo vertices and triangles according parent game object world coordinates // Iterate over each vertex in plotter for (int i = 0; i < plotter.VertexCount; ++i) { // Grab triangle HairyPlotterVertex vertex = plotter.GetVertex(i); // Intersect ray if (HairyPlotter.RayIntersectsVertex(r, t.TransformPoint(vertex.Position), GizmoSize)) { // Found! return(vertex); } } return(null); }