Unity: Rotating GUI text




Just a quick one: Unity/iPhone developer Col000r throws a cool code snippet to do rotated GUI text:

// This comes from Col000r's site: 
//http://col000r.blogspot.com/2009/08/unity-rotated-gui-text.html
function OnGUI () {
   var pos : Vector3 = new Vector3(100, 200, 0); //position for matrix
   var quat : Quaternion = Quaternion.identity; //rotation for matrix
   quat.eulerAngles = Vector3(0, 0, 90); //set the rotation to something - rotate around z!
   GUI.matrix = Matrix4x4.TRS(pos, quat, Vector3.one); //Apply the matrix 
   GUI.Label(Rect(0, 0, 200, 20), "Some Text"); //notice how the rect starts at 0/0 and the matrix handles the position!
}


I've not tried it, but it's pretty cool. Nice work, Col000r. Col000r's got a lot of great tips for programming, sound, modelling and animating. Definitely a blog worth bookmarking/subscribing to.





Feedback - No responses. Yet.

Leave a comment.

Leave a comment

Name:
Website:
Comment:

Email:
Captcha:
Select the icon of an atom from below:

           

           

 

Video Game Design

User Interface Design

Creative & fun stuff

 

I'm Hanford Lemoore. My parking skills are unparalleled.

I design things in Silicon Valley; mostly consumer electronics media players. Perhaps I can design things for you. Check out my UI Portfolio.

When I'm not making things for other people, I'm usually making video games. more

 

Please use our contact form.

 

RSS 2.0

 

monolux.com

tikiroom.com

junkyardclubhouse.com

 


 

   


Copyright 2010 Hanford Lemoore | Blog | About | Portfolio | Contact
Powered by Olark