Search Unity

GUI Rotate Texture2D and managing layers inside my GUI

Discussion in 'Immediate Mode GUI (IMGUI)' started by Smireles, Jul 18, 2008.

  1. Smireles

    Smireles

    Joined:
    Jun 20, 2008
    Posts:
    38
    Good day people!
    Today we are having a hard time developing a tachometer.

    Basically we have two mayor issues:

    1. How do we rotate a texture?
    Background:
    *We want to have an arrow or indicator pointing at the velocity at a specific time.
    *We are using a png, with the arrow starting at the center and moving towards one ledge.
    *We created the texture using a simple line from the GUI master jscript: GUI.DrawTexture (Rect (Screen.width-128, Screen.height - 128, 128, 128), arrow);

    2. How to assign different layers in our GUI, we have the background image of our tachometer, the dynamic numbers, and several other indicators, plus, the arrow of course above all. We need to know how to create and place them in layers in order to give the look we are aiming for.

    Thanks in advance, hope we get a solution (we have open mind for other ways of solution).

    :D
     

    Attached Files:

  2. thylaxene

    thylaxene

    Joined:
    Oct 10, 2005
    Posts:
    716
  3. Smireles

    Smireles

    Joined:
    Jun 20, 2008
    Posts:
    38
    right in the spot thylaxene.

    GUIUtility.RotateAroundPivot worked out perfectly for my purposes

    And about the depth issue, I ended up getting the whole deal inside the same script, that way its just matter of calling them in order "bottom first - top last". But I'm sure ill use GUI.depth next time!

    Thanks again for your advice.
     
  4. jeffcraighead

    jeffcraighead

    Joined:
    Nov 15, 2006
    Posts:
    740
    Could you post a code example, I was messing with RotateAroundPivot and couldn't get the needle to align on a speedometer correctly.

    Thanks!