- Home /
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.
Hi every one, I found how to solve this little problem by myself, I will post the code the next time.
December 2014. Almost four years have passed, and some of us are beginning to lose hope that 3D$$anonymous$$agicVR will post the code. $$anonymous$$ost of the original group have long gone, and only a few of us remain now to keep watch for 3D$$anonymous$$agicVR's post.
Sometimes we despair: How much longer will he keep us waiting? But other times we rejoice - imagine how detailed and informative the post must be, after this much time to work on it!
Your answer
![](https://koobas.hobune.stream/wayback/20220613101331im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is There An OnMouseStop? 0 Answers
GUIUtility.RotateAroundPivot causes blurred text 0 Answers
Camera Rotating Around (0, 0, 0) 2 Answers
something to do with pivot 1 Answer
Can't rotate viewport 2 Answers