zoukankan      html  css  js  c++  java
  • Unity中的物体旋转

    (1)

              物体在对应的坐标系中旋转,默认使用本地坐标系

              public void Rotate(Vector3 eulers, Space relativeTo = Space.Self);

              public void Rotate(float xAngle, float yAngle, float zAngle, Space relativeTo = Space.Self);

             物体在对应的坐标系中以axis为轴进行旋转

              public void Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self);

    (2)

             在世界坐标系中以point的axis方向为轴进行旋转

             public void RotateAround(Vector3 point, Vector3 axis, float angle);

    (3)

              旋转物体,使物体的Z轴指向target。

              worldUp:对象朝向目标后旋转自身,使得worldUp垂直z轴向上

              public void LookAt(Transform target);

              public void LookAt(Transform target, Vector3 worldUp = Vector3.up);

              旋转物体,使物体指向世界坐标系中的一点

              public void LookAt(Vector3 worldPosition);

              public void LookAt(Vector3 worldPosition, Vector3 worldUp = Vector3.up);

    (4)

              计算让Z轴对齐forward,让y轴对齐upward 所需要旋转的四元数

              public static Quaternion LookRotation(Vector3 forward, Vector3 upwards = Vector3.up);

              

            

  • 相关阅读:
    nyoj_216_A problem is easy_201312051117
    nyoj_676_小明的求助_201312042142-2
    C# 堆和栈的区别?
    DataReader和DataSet区别
    SQLSERVER2008R2正确使用索引
    SQL Profiler工具简介
    (转)非常完善的Log4net详细说明
    SQL语句优化技术分析
    HashTable、HashSet和Dictionary的区别
    使用Nuget发布自己的类库包
  • 原文地址:https://www.cnblogs.com/unitywyb/p/12772378.html
Copyright © 2011-2022 走看看