- Home /
Rotating a Rect by the GUI.matrix?
I am trying to create a mouse over event for buttons in my OnGUI method. The popular suggested way to do so is to use the Rect.Contains method; however, if I use GUIUtility.RotateAroundPivot then my Rect positions are in the wrong locations. How can I rotate the GUI elements, and then manipulate the Rect by that GUI.matrix?
RotateAroundPivot is the function to modify the GUI.matrix. Is the pivot point at the position you intend?
Yes. All of the rotated GUI objects are at the desired locations. But I don't know how to use that modified matrix to rotate a rectangle to do a Contains check.
Your answer
![](https://koobas.hobune.stream/wayback/20220613093521im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I set a new Vector 2 for a GUI.Utility RotateAroundPivot? 0 Answers
Detecting if mouse position is inside rect 2 Answers
Can't destroy an ui element 2 Answers
Rect to RectTransform on overlay Canvas? 1 Answer
GUI Rect and 0.000 floats 2 Answers