unity3d 第二十天
来源:互联网 发布:game3799软件下载 编辑:程序博客网 时间:2024/06/14 05:15
旋转控制 Vector3 的right up 和 forward
//Vector3.up => Vector3(0,1,0) 向y轴//Vector3.right => Vector3(1,0,0) 向x轴//Vector3.forward => Vector3(0,0,1) 向z轴
Rotate_test.cs
using UnityEngine;using System.Collections;public class Rotate_test : MonoBehaviour {GameObject objCube;GameObject objSphere;int speed = 100;// Use this for initializationvoid Start () {objCube = GameObject.Find("Cube");objSphere = GameObject.Find("Sphere");}// Update is called once per framevoid Update () {}void OnGUI(){//Vector3.up => Vector3(0,1,0) 向y轴//Vector3.right => Vector3(1,0,0) 向x轴//Vector3.forward => Vector3(0,0,1) 向z轴if (GUILayout.RepeatButton ("立方体沿x轴旋转", GUILayout.Height (50))) {objCube.transform.Rotate(Vector3.right * Time.deltaTime * speed);}if (GUILayout.Button ("立方体沿y轴旋转", GUILayout.Height (50))) {objCube.transform.Rotate(Vector3.up * Time.deltaTime * speed);}if (GUILayout.Button ("立方体沿z轴旋转", GUILayout.Height (50))) {objCube.transform.Rotate(Vector3.forward* Time.deltaTime * speed);}if (GUILayout.Button ("立方体绕球体旋转", GUILayout.Height (50))) {objCube.transform.RotateAround(objSphere.transform.position,Vector3.up,Time.deltaTime * speed);}}}
0 0
- unity3d 第二十天
- 第二十天
- 第二十天
- 第二十天
- 学习Unity3D第二十天建立数据库和表的代码操作。
- Unity3D笔记第二十天——3D图形学(网格基础)
- 世界杯第二十天
- 第二十天 考核
- 第二十天:听课笔记
- 第二十天:总结
- TULING第二十天
- 第二十天总结0416
- 星海第二十天
- 实习日记->第二十天
- 第二十天博客
- 第二十天:IO流
- php实战第二十天
- 实习篇---第二十天
- VS2012简单的使用感受+插件推荐
- 用MATLAB做聚类分析
- Android教你如何一步步打造通用适配器
- Java JDK数据缓冲
- 集合-Arraylist和LinkedList的区别
- unity3d 第二十天
- 看完《机器学习》的总结与心得
- IntentFilter的匹配规则
- Shadow Mapping
- 由遍历序列构造二叉树
- PAT-A 1092. To Buy or Not to Buy
- springboot处理session时间周期
- 关于一条sql语句中子查询的返回值不止一个,且拼接成相关规则的字符串
- c++中malloc,free,new,delete区别和联系