Hola amigos.
Hoy os traigo un script para rotar un objeto con el botón derecho del ratón y unas botoneras
para cambiar el fondo de la escena.
#pragma strict var camara : Camera; var colores : Color []= [Color.red, Color.white, Color.green, Color.yellow, Color.grey]; var texturasColores : Texture []; var velocidad : float = 45; var rotaEnY : boolean = true; var y : float; function Start () { texturasColores = new Texture [colores.Length]; } function Update () { if(Input.GetButton ("Fire2") && rotaEnY == true){ y -= Input.GetAxis("Mouse X") * velocidad * Time.deltaTime; transform.rotation = Quaternion.Euler (0,y,0); } } function OnGUI () { for(var i : int;i < colores.Length;i++){ GUI.backgroundColor = colores[i]; if (GUI.Button(Rect(10+(20*i),10,20,20),texturasColores[i])){ FondoCam (colores[i]); } } } function FondoCam (colores : Color) { camara.backgroundColor = colores; }
No hay comentarios:
Publicar un comentario