Search Unity

Rotating GUI.Box causes clipping

Discussion in 'Immediate Mode GUI (IMGUI)' started by gretty, May 13, 2013.

  1. gretty

    gretty

    Joined:
    Jun 20, 2012
    Posts:
    72
    Hello

    I am attempting to rotate 2 different GUI Boxes's on the Z Axis. Each box will have a different Z axis value. The following image shows how I am trying to make them appear(I made the following image in photoshop):

    http://answers.unity3d.com/storage/attachments/10993-3dgui.jpg
    View attachment 53236

    My Problem: I am unable to rotate my boxes on the Z axis without clipping occurring. I can successfully rotate my panels on the x and y axis but not the Z without clipping occurring. Also can I have 2 boxes with a different z rotation using GUI.Matrix (I've read in other questions that this isn't possible)?

    This is what happens: http://answers.unity3d.com/storage/attachments/10994-capture.jpg
    View attachment 53236

    Any ideas how I can achieve the rotation that is shown in my first image?

    Code (csharp):
    1. void OnGUI() {
    2.         Matrix4x4 guiMatrixOrig = GUI.matrix;
    3.         GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 45, 0), new Vector3(1.0f, 1.0f, 1.0f));
    4.         GUI.Box (new Rect (10,10,400, 400), "Loader Menu");
    5.         GUI.matrix = guiMatrixOrig;
    6.     }
     
    Last edited: May 15, 2013
  2. col000r

    col000r

    Joined:
    Mar 27, 2008
    Posts:
    699
    I've run into the same issue and found no way around it. It seems the clipping planes of the GUI-Camera are very close together. For something like this, I'm afraid you might have to use some other system (like NGUI) instead...
     
  3. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Unfortunately, you cannot rotate UnityGUI in 3D. You can rotate and resize it in 2D, so "skewing" is the maximum you can get. You cannot put it into the perspective.