unity Transform 的 Rotate(xAngle: float, yAngle: float, zAngle: float, relativeTo: Space = Space.Self, Space.World); 刨根问底

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class demoword2 : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        //transform.Rotate(60, 70, 80, Space.World);
        //eulerAngles.z度围绕z轴,eulerAngles.x度围绕x轴,eulerAngles.y度围绕y轴
        //unity Inspector 面板上的rotation旋转:XYZ 是 相对于父坐标的旋转值
        //一次旋转一个轴: zxy 世界坐标 《====》  yxz (本地坐标顺序)
        //一次旋转三个轴:transform.Rotate(x, y, z, Space.World)  他可以才分为 先旋转z轴,再x轴,再y轴 等价
        transform.Rotate(0, 0, 80, Space.World);
 
        transform.Rotate(60, 0, 0, Space.World);
         
        transform.Rotate(0, 70, 0, Space.World);
 
    }
 
    // Update is called once per frame
    void Update()
    {
        //transform.Rotate(10 * Time.deltaTime, 20 * Time.deltaTime, 30 * Time.deltaTime, Space.World);
    }
}

  

unity 这种旋转方式很特别,刨根问底....

说明:godot 没有这样的旋转方法,只有类似  void rotate ( Vector3 axis, float angle )   围绕轴(单位 Vector3)旋转局部变换,指定角度(弧度)。 

posted @   porter_代码工作者  阅读(29)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示