Hi!
Using the GUI.RotateAroundPivot I can make a needle pointer rotate around a dial face for a nice speed indicator, but I also want this to scale with the rest of the GUI for any change in screen size.
Using GUI.ScaleAroundPivot Scales the needle correctly but then I’ve lost the rotation. Is it possible to both rotate AND scale the needle around the pivot?
Any help would be very much appreciated.
Yeah, that’s possible - I’m using it. You might have to change the order (I first scale and then rotate, and it works).
Eventually I managed to figure this out! I am so happy!!
}
function OnGUI() {
var thisMph = TheCar.GetSpeed ();
thisMph = thisMph*4;
if (thisMph>284){
thisMph=284;
}
GUI.depth = -10;
GUI.matrix = Matrix4x4.TRS (Vector3(0,0,0), Quaternion.identity, Vector3 (Screen.width / 1680.0, Screen.height / 1050.0, 1));
newWidth = Screen.width/1680.0;
newHeight = Screen.height/1050.0;
GUIUtility.RotateAroundPivot(thisMph-140,Vector2(newWidth*120,newHeight*929));
GUI.Label(Rect(22,831,197,197),Needle);
}
The don’t need to ScaleAaroundPivot, I just needed to scale the pivot point in the RotateAroundPivot:
works very nicely now.
Ta Ta!