static bool GetPlaneFromProGridsAxis(Vector2 mousePosition, out Plane plane) { if (!ProGridsInterface.ProGridsActive() || !ProGridsInterface.GridVisible()) { plane = default(Plane); return(false); } Vector3 point = SceneView.lastActiveSceneView.pivot; Vector3 progridsPivot; if (ProGridsInterface.GetPivot(out progridsPivot)) { point = progridsPivot; } Vector3 normal = Vector3.up; if (ProGridsInterface.IsFullGridEnabled()) { var ray = HandleUtility.GUIPointToWorldRay(mousePosition); Plane[] planes = new Plane[3] { new Plane(Vector3.right, point), new Plane(Vector3.up, point), new Plane(Vector3.forward, point) }; float closestDistance = Mathf.Infinity; Plane closestPlane = default(Plane); for (int i = 0; i < planes.Length; ++i) { float distance; if (planes[i].Raycast(ray, out distance)) { if (distance < closestDistance) { closestDistance = distance; closestPlane = planes[i]; } } } plane = new Plane(closestPlane.normal, point); } else { var axis = ProGridsInterface.GetActiveGridAxis(); float offset = ProGridsInterface.GetActiveGridOffset(); switch (axis) { case HandleAxis.X: point.x += offset; normal = Vector3.right; break; case HandleAxis.Y: point.y += offset; normal = Vector3.up; break; case HandleAxis.Z: point.z += offset; normal = Vector3.forward; break; } plane = new Plane(normal, point); } return(true); }