Quaternions are used to represent rotations.

四元数用于表示旋转。

They are compact, don't suffer from gimbal lock and can easily be interpolated. Unity internally uses Quaternions to represent all rotations.

它们是紧凑的,不会出现万向节锁并且能够很容易被插值。Unity内使用Quaternion表示所有旋转。

However, they are based on complex numbers and are not easy to understand intuitively. Thus you almost never access or modify individual Quaternion components (x,y,z,w); most often you would just take existing rotations (e.g. from the Transform) and use them to construct new rotations (e.g. to smoothly interpolate between two rotations). The Quaternion functions that you use 99% of the time (The other functions are only for exoctic uses) Quaternion.LookRotationQuaternion.Angle,Quaternion.EulerQuaternion.SlerpQuaternion.FromToRotationQuaternion.identity

然而,它们基于复数的并不容易被直观地理解,因此你没有必要访问或修改单个Quaternion组件(x,y,z,w);通常你只需把现有的旋转(例如,来自Transform)并使用它们来构造新的旋转(例如,在两个旋转间平滑地插值)。四元数函数你99%的时间你会使用它(其他函数仅额外使用)Quaternion.LookRotationQuaternion.AngleQuaternion.EulerQuaternion.Slerp,Quaternion.FromToRotationQuaternion.identity

You can use Quaternion.operator * to rotate one rotation by another, or to rotate a vector by a rotation.

你可以使用Quaternion.operator *由另一个四元数来旋转一个旋转角度,或由一个旋转角度来旋转一个向量。

Variables变量

  • X component of the Quaternion. Don't modify this directly unless you know quaternions inside out.
    四元数的X组件。不要直接修改这个,除非你很了解四元数。
  • Y component of the Quaternion. Don't modify this directly unless you know quaternions inside out.
    四元数的Y组件。不要直接修改这个,除非你很了解四元数。
  • Z component of the Quaternion. Don't modify this directly unless you know quaternions inside out.
    四元数的Z组件。不要直接修改这个,除非你很了解四元数。
  • W component of the Quaternion. Don't modify this directly unless you know quaternions inside out.
    四元数的W组件。不要直接修改这个,除非你很了解四元数。
  • Access the x, y, z, w components using [0], [1], [2], [3] respectively.
    分别使用 [0]、[1]、 [2]、 [3],访问x、y、z、w组件。
  • Returns the euler angle representation of the rotation.
    返回表示旋转的欧拉角度。

Constructors构造器

  • Constructs new Quaternion with given x,y,z,w components.
    用给定的x、y、z、w组件,构造新的四元数。

Functions函数

  • Converts a rotation to angle-axis representation.
    转换一个旋转用“角-轴”表示。
  • Creates a rotation which rotates from fromDirection to toDirection.
    创建一个从fromDirection到toDirection的旋转。
  • Creates a rotation that looks along forward with the the head upwards along upwards
    创建一个旋转,沿着forward(z轴)并且头部沿着up(y轴)的约束注视。
  • Returns a nicely formatted string of the Quaternion
    返回一个格式化好的四元数字符串。

Class Variables类变量

  • The identity rotation (Read Only). This quaternion corresponds to "no rotation": the object
    同一性旋转(只读)。该四元数,相当于"无旋转":这个物体完全对齐于世界或父轴。

Class Functions类函数

    • Combines rotations lhs and rhs.
      组合旋转lhs和rhs。
    • Are two quaternions equal to each other?
      两个四元数相等?
    • Are two quaternions different from each other?
      两个四元数是不相等的?
    • The dot product between two rotations.
      两个旋转之间的点乘。
    • Creates a rotation which rotates angle degrees around axis.
      绕axis轴旋转angle,创建一个旋转。
    • Creates a rotation which rotates from fromDirection to toDirection.
      从fromDirection到toDirection创建一个旋转。
    • Creates a rotation that looks along forward with the the head upwards along upwards
      创建一个旋转,沿着forward(z轴)并且头部沿着upwards(y轴)的约束注视。
    • Spherically interpolates from towards to by t.
      球形插值,通过t值from向to之间插值。
    • Interpolates from towards to by t and normalizes the result afterwards.
      通过t值from向to之间插值,并且规范化结果。
    • Rotates a rotation from towards to.
      旋转一个角度从from向to。
    • Returns the Inverse of rotation.
      返回反向的旋转。
    • Returns the angle in degrees between two rotations a and b.
      返回a和b两者之间的角度。
    • Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order).
      返回一个旋转角度,绕z轴旋转z度,绕x轴旋转x度,绕y轴旋转y度(像这样的顺序)。

Quaternion 四元数的更多相关文章

  1. [Unity Quaternion]四元数Quaternion的计算方式

    什么是Quaternion四元数 1843年,William Rowan Hamilton发明了四元数,但直到1985年才有一个叫Ken Shoemake的人将四元数引入计算机图形学处理领域.四元数在 ...

  2. Unity3D_(API)Quaternion四元数中的Quaternion.LookRotation()

    四元数百度百科: 传送门 四元数官方文档: 传送门 欧拉旋转.四元数.矩阵旋转之间的差异: 传送门 四元数转换为欧拉角eulerAngles 官方文档: 传送门 欧拉角转换为四元数Euler 官方文档 ...

  3. cocos2dx Quaternion 四元数(1/2)

    这篇文章只是我学完四元数之后的一些理解,其实是对别人理解的理解,有些地方我理解但是没有写下来,如果真的想深入的学习四元数,建议从学习复数开始. 这个知识点需要几何想象的天赋和学习的耐心,缺一不可,慢慢 ...

  4. 学习和研究下unity3d的四元数 Quaternion

    学习和研究下unity3d的四元数 Quaternion 今天准备学习和研究下unity3d的四元数 Quaternion 四元数在电脑图形学中用于表示物体的旋转,在unity中由x,y,z,w 表示 ...

  5. unity3d的四元数 Quaternion

    原地址:http://www.cnblogs.com/88999660/archive/2013/04/02/2995074.html 今天准备学习和研究下unity3d的四元数 Quaternion ...

  6. 关于Rotation和Quaternion的一些问题

    当我们使用unity的时候,面对一个物体,一个不可避免的问题就是:控制物体的旋转. unity的Transform组件的第二个属性Rotation为我们提供控制物体旋转的功能.在一个物体的Inspec ...

  7. three.js 欧拉角和四元数

    这篇郭先生就来说说欧拉角和四元数,欧拉角和四元数的优缺点是老生常谈的话题了,使用条件我就不多说了,我只说一下使用方法. 1. 欧拉角(Euler) 欧拉角描述一个旋转变换,通过指定轴顺序和其各个轴向上 ...

  8. 【腾讯Bugly干货分享】WebVR如此近-three.js的WebVR示例解析

    本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/57c7ff1689a6c9121b1adb16 作者:苏晏烨 关于WebVR 最 ...

  9. Unity3D 脚本手册

    1.private Ray ray;  --定义射线 ray = Camera.main.ScreenPointToRay(Input.mousePosition);  --摄像机发出的射线投射鼠标到 ...

随机推荐

  1. 关于js的addEventListener 和一些常用事件

    element.addEventListener(<event-name>, <callback>, <use-capture>);document.addEven ...

  2. cygwin设置

    解决乱码问题 # 设置为中文环境,使提示成为中文  export LANG =" zh_CN.UTF-8 " # 输出为中文编码  export OUTPUT_CHARSET =& ...

  3. hdu 2489(状态压缩+最小生成树)

    Minimal Ratio Tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  4. C#中使用aria2c进行下载并显示进度条

    正则表达式的生成网站: http://www.txt2re.com/index-csharp.php3 Aria2c下载地址: https://github.com/aria2/aria2/relea ...

  5. 史上最全的web前端开发程序员学习清单!

    今天为什么要给大家分享这篇文章呢,我发现最近来学前端的特别多,群里面整天都有人问:前端好找工作吗?前端要怎么学啊?前端工资怎么样?前端XX,前端XXX,虽然我回答过无数次这种问题了,但是问这个的还是有 ...

  6. thinkphp函数学习(2)——microtime, memory_get_usage, dirname, strtolower, is_file

    1. microtime() 返回  微秒 秒  这种格式的内容 例子 <?php echo(microtime()); ?> 输出: 0.25139300 1138197510 // 前 ...

  7. Python Unittest与数据驱动

    python中有一个装饰器类DDT,通过它我们可以复用代码,达到数据驱动测试的目的,该类的官方介绍可以参考 http://ddt.readthedocs.io/en/latest/index.html ...

  8. bzoj3225 [Sdoi2008]立方体覆盖——扫描线

    3225: [Sdoi2008]立方体覆盖 Description A君近日为准备省队选拔,特意进行了数据结构的专项训练.训练过程中就遇到了“矩形面积并”这道经典问题,即:给出N个各边与坐标轴平行(垂 ...

  9. 51Nod - 1405 树的距离之和(树形DP)

    1405 树的距离之和 题意 给定一棵无根树,假设它有n个节点,节点编号从1到n,求任意两点之间的距离(最短路径)之和. 分析 树形DP. 首先我们让 \(1\) 为根.要开两个数组 \(up \ d ...

  10. 网络监控工具ntopng

    网络监控工具ntopng   ntopng是Kali提供的一个网络监控软件,用于显示当前网络的使用情况.它能列出当前使用网络的主机,并且显示每台主机发送和接受的数据包.同时,它提供强大的数据处理功能, ...