x


RotateAroundPivot rong offset

Hi every one, working with the GUIUtility RotateAroundPivot I got this weird situation.

when try to center A GUIButton with the Screen.width and the Screen.height and drag the corner of the window to resize it, the button move away from the center but the pivot point remains on the center of the screen, but when I use direct numbers (400 - 40, 300 - 40) the button remains on the center but the pivot not, this is the code:

var rectButton : Rect = Rect(0, 0, 80, 80);
private var refAngle = float;
// With a function to increase the refAngle value
function ONGUI() {
    GUI.matrix = Matrix4x4.TRS(Vectro3.zero, Quaternion.identity, Vector3(Screen.width / 600.0, Screen.height / 600.0, 1));
    GUI.BeginGroup(new Rect(Screen.width / 2 - rectButton.width / 2, Screen.height / 2 - rectButton.height / 2, rectButton.width, rectButton.height));
    GUIUtility.RotateAroundPivot(refAngle, Vector2(40, 40));
    GUI.Box(Rect(0, 0, 80, 80), "Spin");
    GUI.EndGroup();
}

Any help will be very appreciated, for you attention thanks.

more ▼

asked Jan 27 '11 at 03:49 AM

3DMagicVR gravatar image

3DMagicVR
152 2 2 11

Hi every one, I found how to solve this little problem by myself, I will post the code the next time.

Jan 31 '11 at 07:04 PM 3DMagicVR

Are you still going to post an answer some time?

May 08 at 07:24 AM Krummelz
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x727
x85
x71
x8

asked: Jan 27 '11 at 03:49 AM

Seen: 950 times

Last Updated: May 08 at 07:24 AM