private static void HandleDirectionalCursor(Vector3 handlePosition, Vector3 handlePlaneNormal, Vector3 direction) { Vector2 mousePosition = Event.current.mousePosition; Plane plane = new Plane(handlePlaneNormal, handlePosition); Vector3 worldPos; if (RectHandles.RaycastGUIPointToWorldHit(mousePosition, plane, out worldPos)) { Vector2 direction2 = RectHandles.WorldToScreenSpaceDir(worldPos, direction); Rect position = new Rect(mousePosition.x - 100f, mousePosition.y - 100f, 200f, 200f); EditorGUIUtility.AddCursorRect(position, RectHandles.GetScaleCursor(direction2)); } }
private static void HandleDirectionalCursor(Vector3 handlePosition, Vector3 handlePlaneNormal, Vector3 direction) { Vector2 mousePosition = Event.current.mousePosition; Plane plane = new Plane(handlePlaneNormal, handlePosition); Vector3 hit; if (!RectHandles.RaycastGUIPointToWorldHit(mousePosition, plane, out hit)) { return; } Vector2 screenSpaceDir = RectHandles.WorldToScreenSpaceDir(hit, direction); EditorGUIUtility.AddCursorRect(new Rect(mousePosition.x - 100f, mousePosition.y - 100f, 200f, 200f), RectHandles.GetScaleCursor(screenSpaceDir)); }