- Home /
GUI Group Clipping on Rotation
I have run into a problem with using GUI.BeginGroup
coupled with GUIUtility.RotateAroundPivot
.
My goal is to have several objects rendered within one distinct rectangle on screen. For this example, let's just say that I was the objects to be rendered inside of
Rect r = new Rect(0,0,Screen.width,Screen.height);
Now, this works perfectly fine for rendering them where I need to, provided that I do not need to rotate the Textures
.
I have been using the following method to render with the rotation:
GUI.BeginGroup(r);
Rect rect = //calculations to determine rect
Texture texture = //loads Textire
Matrix4x4 mtx = GUI.matrix;
float rot = //calculates rotation value
GUIUtility.RotateAroundPivot(rot,rect.center);
GUI.DrawTexture(rect,texture);
GUI.matrix = mtx;
GUI.EndGroup();
I need the group Rect
to remain in place for clipping purposes (in the real example, it won't be the screen dimensions), but the group rotates along with the textures that I am rendering. Is there a way to achieve this effect while remaining in the GUI Layer?
EDIT
My main concern is in displaying GUI elements and GUITextures as well. In this case, I currently have GUI elements that the GUI Group
was helping to keep from overlapping on a GUITexture
. Should the GUI Group
prove to be impossible, is there any way to display a GUITexture over top of GUI?
Your answer
Follow this Question
Related Questions
Limiting object rotation using GUI.Buttons? 1 Answer
Finish rotation in the same angle of beginning? 1 Answer
how can i flip my scoredisplay var guitext so that it appears upside down? 0 Answers
Attach image to button 1 Answer
Clamping Rotation 2 Answers