U3D 随笔
2013-08-14 17:00
197 查看
http://unity3d.com/ 资源站
http://docs.unity3d.com/Documentation/ScriptReference/index.html 最新API
new Rect(100f/1024*Screen.width, 160f/768*Screen.height, 800, 580) 格式化分辨率(不靠谱。以后可以用插件)
public enum Menu
{start=1, option, help, quite}
//枚举 可以规定起始值 默认为0(Menu option_t = Menu.option ; option_t.GetHashCode()=2)
Vector2(2维向量)
Vector2 center = new Vector2(Screen.width/2f, Screen.height/2f) ;//移到屏幕中心
Time.time(当前时间)
Texture2D(二维纹理)
Vector2 mousePos = new Vector2(Input.mousePosition.x, Screen.height-Input.mousePosition.y) ;//坐标系转换为GUI坐标系(左上0,0)
angle = Mathf.Atan2(center.x-mousePos.x, mousePos.y-center.y)*Mathf.Rad2Deg ;//获得当前角度
Update控制播放速度和物体朝向
void Update () {
if(Time.time>lasttime+stepTime){
cnt = (cnt + 1)%10 ;
lasttime = Time.time ;
}
Vector2 mousePos = new Vector2(Input.mousePosition.x, Screen.height-Input.mousePosition.y) ;
angle = Mathf.Atan2(center.x-mousePos.x, mousePos.y-center.y)*Mathf.Rad2Deg ;//获得当前角度
// if(Input.GetMouseButton(0)){
// StartCoroutine(playMove(mousePos)) ;
// }
}
http://docs.unity3d.com/Documentation/ScriptReference/index.html 最新API
new Rect(100f/1024*Screen.width, 160f/768*Screen.height, 800, 580) 格式化分辨率(不靠谱。以后可以用插件)
public enum Menu
{start=1, option, help, quite}
//枚举 可以规定起始值 默认为0(Menu option_t = Menu.option ; option_t.GetHashCode()=2)
Vector2(2维向量)
Vector2 center = new Vector2(Screen.width/2f, Screen.height/2f) ;//移到屏幕中心
Time.time(当前时间)
Texture2D(二维纹理)
Vector2 mousePos = new Vector2(Input.mousePosition.x, Screen.height-Input.mousePosition.y) ;//坐标系转换为GUI坐标系(左上0,0)
angle = Mathf.Atan2(center.x-mousePos.x, mousePos.y-center.y)*Mathf.Rad2Deg ;//获得当前角度
Update控制播放速度和物体朝向
void Update () {
if(Time.time>lasttime+stepTime){
cnt = (cnt + 1)%10 ;
lasttime = Time.time ;
}
Vector2 mousePos = new Vector2(Input.mousePosition.x, Screen.height-Input.mousePosition.y) ;
angle = Mathf.Atan2(center.x-mousePos.x, mousePos.y-center.y)*Mathf.Rad2Deg ;//获得当前角度
// if(Input.GetMouseButton(0)){
// StartCoroutine(playMove(mousePos)) ;
// }
}
相关文章推荐
- 菜鸟学U3D心得随笔
- 随笔 - 最后的一抹云彩
- 个人随笔
- 随笔:linux中正则表达式BRE模式下的特殊匹配字符
- 随笔 - 蝶
- cordova开发跨平台应用问题随笔记
- 随笔:linux正则表达式.*查找任意位置的两内容
- Flex 学习随笔 ---- 继续玩 3D Chart (Ilog)
- vForum 2014点滴随笔
- 随笔:linux正则表达式ERE模式中的管道符号“|”(代表or)
- 随笔
- sql 知识 随笔
- U3D -- 图集分割和使用
- 2009年的第一篇随笔
- 微软宣布.NET开发环境开源 支持三大操作系统-随笔
- u3d DoTween子物体回到原位
- 漫谈自动化程度(观WD泰国工厂生产线随笔之三)
- U3D同时播放2个声音
- ElasticSearch 学习 4000 随笔
- 随笔 - 生活与生命