Unity--旋转方法
来源:互联网 发布:个人理财软件 编辑:程序博客网 时间:2024/06/08 11:03
************************************************************************************
旋转自身坐标系--实现待旋转的物体的Z轴始终指向目标位置,这个可以用于追踪目标位置,
Transform target;
transform.LookAt(target);
2、public void LookAt(Vector3 worldPosition, Vector3 worldUp = Vector3.up);
transform.LookAt(Vector3.zero);
************************************************************************************
在世界坐标系或者本地坐标系下 绕某个轴旋转---实现按照固定的顺序 绕各个轴旋转一定的角度
多用于自身要旋转的角度
3、public void Rotate(Vector3 eulerAngles, Space relativeTo = Space.Self);
// Rotate the object around its local X axis at 1 degree per second
transform.Rotate(Vector3.right * Time.deltaTime);
// ...also rotate around the World's Y axis
transform.Rotate(Vector3.up * Time.deltaTime, Space.World);
4、public void Rotate(float xAngle, float yAngle, float zAngle, Space relativeTo = Space.Self);
// Rotate the object around its local X axis at 1 degree per second
transform.Rotate(Time.deltaTime, 0, 0);
// ...also rotate around the World's Y axis
transform.Rotate(0, Time.deltaTime, 0, Space.World);
5、public void Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);
// Rotate the object around its local X axis at 1 degree per second
transform.Rotate(Vector3.right, Time.deltaTime);
// ...also rotate around the World's Y axis
transform.Rotate(Vector3.up, Time.deltaTime, Space.World);
************************************************************************************
在世界坐标系下 绕固定点、固定方向旋转,
用于绕固定点旋转中,例如 地球绕太阳旋转等实例中,实现始终保持一定的半径旋转
6、public void RotateAround(Vector3 point, Vector3 axis, float angle);
transform.RotateAround(Vector3.zero, Vector3.up, 20 * Time.deltaTime);
旋转自身坐标系--实现待旋转的物体的Z轴始终指向目标位置,这个可以用于追踪目标位置,
当目标在移动时,待旋转的物体,会始终保持Z轴指向该目标位置
1、public void LookAt(Transform target, Vector3 worldUp = Vector3.up);Transform target;
transform.LookAt(target);
2、public void LookAt(Vector3 worldPosition, Vector3 worldUp = Vector3.up);
transform.LookAt(Vector3.zero);
************************************************************************************
在世界坐标系或者本地坐标系下 绕某个轴旋转---实现按照固定的顺序 绕各个轴旋转一定的角度
多用于自身要旋转的角度
3、public void Rotate(Vector3 eulerAngles, Space relativeTo = Space.Self);
// Rotate the object around its local X axis at 1 degree per second
transform.Rotate(Vector3.right * Time.deltaTime);
// ...also rotate around the World's Y axis
transform.Rotate(Vector3.up * Time.deltaTime, Space.World);
4、public void Rotate(float xAngle, float yAngle, float zAngle, Space relativeTo = Space.Self);
// Rotate the object around its local X axis at 1 degree per second
transform.Rotate(Time.deltaTime, 0, 0);
// ...also rotate around the World's Y axis
transform.Rotate(0, Time.deltaTime, 0, Space.World);
5、public void Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);
// Rotate the object around its local X axis at 1 degree per second
transform.Rotate(Vector3.right, Time.deltaTime);
// ...also rotate around the World's Y axis
transform.Rotate(Vector3.up, Time.deltaTime, Space.World);
************************************************************************************
在世界坐标系下 绕固定点、固定方向旋转,
用于绕固定点旋转中,例如 地球绕太阳旋转等实例中,实现始终保持一定的半径旋转
6、public void RotateAround(Vector3 point, Vector3 axis, float angle);
transform.RotateAround(Vector3.zero, Vector3.up, 20 * Time.deltaTime);
0 0
- Unity--旋转方法
- unity 控制旋转的方法
- Unity摁键生成,旋转方法
- [cnblogs镜像]Unity 自己旋转 方法
- [Unity]旋转
- 让物体围绕自身某一点旋转的方法 Unity
- Unity 屏幕旋转
- unity 旋转函数
- Unity物体全方位旋转
- Unity的旋转问题
- unity旋转相关
- unity 刚体的旋转
- unity旋转 缩放摄像机
- Unity的旋转
- Unity 旋转角度计算
- Unity控制移动、旋转
- Unity 中的旋转
- Unity 3D - 旋转
- [LeetCode]205. Isomorphic Strings
- 混编ObjectiveC++
- 嵌入式系统的基本概念
- Mybatis总结(2)---Mybatis全局配置文件SqlMapConfig.xml
- js取json对象的键和值
- Unity--旋转方法
- Assembly.Load,Assembly.LoadFrom,Assembly.LoadFile的简单用法
- 开发记录(游戏开黑)
- java操作pdf生成条形码与图片水印
- POJ 1011 Sticks(深搜+剪枝)
- Baxter机器人末端轨迹采集
- final
- 【Unity&AssetStore&工作室】商店里面不错的工作室
- Array