zoukankan      html  css  js  c++  java
  • 「Unity」将Vector3转化为Quaternion

    重载1:
    static Quaternion Euler (float x ,float y,float z)

    Description:
    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度(像这样的顺序)。

    具体使用代码如下:

    //将transform中的rotation修改成(0,30,0)
     Quaternion rotation = Quaternion.Euler(0f, 30f, 0f);
     transform.rotation = rotation;

    重载2:
    static Quaternion Euler (Vector3 rotationVector3)

    Description:
    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度(像这样的顺序)。

    具体使用代码如下:

     //将transform中的rotation修改成(0,30,0)
     Vector3 rotationVector3 = new Vector3(0f, 30f, 0f);
     Quaternion rotation = Quaternion.Euler(rotationVector3);
     transform.rotation = rotation;

    原创文章,转载请注明出

    http://www.cnblogs.com/777777-716/p/5003958.html

  • 相关阅读:
    抽象类abstract
    final关键字特点
    继承ExtendsFour
    继承(继承中构造方法的关系)
    继承ExtendsTwo-super&this
    继承ExtendsOne
    静态
    构造方法与setXxx方法
    15.8
    15.7
  • 原文地址:https://www.cnblogs.com/777777-716/p/5003958.html
Copyright © 2011-2022 走看看