unity3d 第一天
来源:互联网 发布:组播mac地址有什么用 编辑:程序博客网 时间:2024/03/29 20:20
Script01 (mainCamera对象)
#pragma strict//接受外部字符串var str: String;//接受外部赋值贴图var imageTexture : Texture;//贴图宽度private var imageWidth : int;//贴图高度private var imageHeight : int;//当前屏幕高度private var screenWidth : int;//当前屏幕宽度private var screenHeight : int;function Start () {screenWidth = Screen.width;screenHeight = Screen.height;imageWidth = imageTexture.width;imageHeight = imageTexture.height;}function OnGUI(){GUI.Label(Rect(100,150,100,30),str);GUI.Label(Rect(100,190,100,30),"当前屏幕宽:" + screenWidth);GUI.Label(Rect(100,230,100,30),"当前屏幕高:" + screenHeight);//将体育显示在屏幕中GUI.Label(Rect(100,130,200,150),imageTexture);//GUI.Label(Rect(100,280,imageWidth,imageHeight),imageTexture);}function Update () {}Script02 (cube对象)
#pragma strict//模型移动速度var TranslateSpeed = 20;//模型旋转速度var RotateSpeed = 1000;//绘制UIfunction OnGUI(){GUI.backgroundColor = Color.red;if(GUI.Button(Rect(10,10,70,30),"向左旋转")){transform.Rotate(Vector3.up *Time.deltaTime * (-RotateSpeed));}if(GUI.Button(Rect(90,10,70,30),"向前移动")){transform.Translate(Vector3.forward * Time.deltaTime * TranslateSpeed);}if(GUI.Button(Rect(170,10,70,30),"向右旋转")){transform.Rotate(Vector3.up *Time.deltaTime * RotateSpeed);}if(GUI.Button(Rect(170,50,70,30),"向右移动")){transform.Translate(Vector3.right * Time.deltaTime * TranslateSpeed);}if(GUI.Button(Rect(90,50,70,30),"向后移动")){transform.Translate(Vector3.forward * Time.deltaTime * (-TranslateSpeed));}if(GUI.Button(Rect(10,50,70,30),"向左移动")){transform.Translate(Vector3.right * Time.deltaTime * (-TranslateSpeed));}GUI.Label(Rect(250,10,200,30),"模型位置" +transform.position);GUI.Label(Rect(250,50,200,30),"模型的旋转" +transform.rotation); }/*function Start () {}function Update () {}*/
0 0
- unity3D第一天
- Unity3D---学习第一天
- 【Unity3D】学习第一天
- unity3d 学习第一天
- unity3d初学第一天
- unity3d 第一天
- Unity3d日记--第一天
- unity3d 第一天
- Unity3D学习日志第一天
- 学习Unity3D第一天之基础入门。
- Unity3D笔记第一天——资源、项目
- 第一天
- 第一天
- 第一天~
- 第一天
- 第一天
- 第一天
- 第一天
- sqlite3数据库在linux下安装以及设置成交叉编译
- JAVA设计模式之单例模式
- 0.ARM裸机学前补充知识
- android:orientation
- 欢迎使用CSDN-markdown编辑器
- unity3d 第一天
- spring 常用配置
- Servlet学习笔记(HTTP请求详细了解以及文件下载示例)
- javascript的基础学习
- Reveal真机查看任意APP
- Android自定义控件:动画类----alpha、scale、translate、rotate、set的xml属性及用法
- jsp基础
- Milking Cows
- 11、mysql运算符----第2篇