Quaternion四元数
public static Quaternion identity { get; }
摘要:The identity rotation (Read Only). 标识旋转(只读)。/空旋转
Debug.Log(Quaternion.identity);
transform.rotation = Quaternion.identity;
--->
public Vector3 eulerAngles { get; set; }
摘要:Returns or sets the euler angle representation of the rotation. 返回或设置旋转的欧拉角表示。
public static float Angle(Quaternion a, Quaternion b);
摘要:Returns the angle in degrees between two rotations a and b.返回两个旋转a和b之间的角度(以角度为单位)。
public static Quaternion AngleAxis(float angle, Vector3 axis);
摘要:Creates a rotation which rotates angle degrees around axis.沿着某个轴旋转到指定角度
transform.rotation = Quaternion.AngleAxis(50,Vector3.up);
public static float Dot(Quaternion a, Quaternion b);
摘要:The dot product between two rotations. 两个旋转之间的点积。
public static Quaternion Euler(Vector3 euler);
public static Quaternion Euler(float x, float y, float z);
摘要:Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis. 返回绕z轴旋转z度的旋转,绕x轴旋转x度,绕y轴旋转y度的旋转。/转为欧拉角
public static Quaternion FromToRotation(Vector3 fromDirection, Vector3 toDirection);
摘要:Creates a rotation which rotates from fromDirection to toDirection. 创建一个从一个方向旋转到另一个方向的旋转。
Debug.Log(Quaternion.FromToRotation(Vector3.right,Vector3.up));
public static Quaternion Inverse(Quaternion rotation);
摘要:Returns the Inverse of rotation.返回旋转的倒数。
Debug.Log(new Quaternion(0, 0, 0.7f, 0.7f).eulerAngles);
Debug.Log(Quaternion.Inverse(new Quaternion(0,0,0.7f,0.7f)).eulerAngles);
public static Quaternion Lerp(Quaternion a, Quaternion b, float t);
摘要:Interpolates between a and b by t and normalizes the result afterwards. The parameter t is clamped to the range [0, 1].
用t在a和b之间插入,然后对结果进行标准化。参数t被夹在[0,1]范围内。
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(0, transform.eulerAngles.y + 90, 0), 0.1f);
public static Quaternion LerpUnclamped(Quaternion a, Quaternion b, float t);
摘要:Interpolates between a and b by t and normalizes the result afterwards. The parameter t is not clamped.
用t在a和b之间插入,然后对结果进行标准化。参数t没有被限制。
public static Quaternion LookRotation(Vector3 forward);
public static Quaternion LookRotation(Vector3 forward, [DefaultValue("Vector3.up")] Vector3 upwards);
摘要:Creates a rotation with the specified forward and upwards directions. 创建具有指定正向和向上方向的旋转。/朝向某向量
transform.rotation = Quaternion.LookRotation(Vector3.right);
public static Quaternion RotateTowards(Quaternion from, Quaternion to, float maxDegreesDelta);
摘要:Rotates a rotation from towards to. 以maxDegreesDelta的角速度从from旋转到to
transform.rotation = Quaternion.RotateTowards(transform.rotation, new Quaternion(0, 0, 0.7f, 0.7f), 0.1f);
public static Quaternion Slerp(Quaternion a, Quaternion b, float t);
摘要:Spherically interpolates between a and b by t. The parameter t is clamped to the range [0, 1]. 通过t在a和b之间进行球面插值。参数t被夹在[0,1]范围内。/球形插值/弧形插值
transform.rotation = Quaternion.Slerp(transform.rotation, new Quaternion(0, 0, 0.7f, 0.7f), 0.1f);
public static Quaternion SlerpUnclamped(Quaternion a, Quaternion b, float t);
摘要:Spherically interpolates between a and b by t. The parameter t is not clamped.
用t在a和b之间进行球面插值。参数t没有被限制。
public void Set(float newX, float newY, float newZ, float newW);
摘要:Set x, y, z and w components of an existing Quaternion. 设置/赋值
Quaternion quaternion = transform.rotation;
quaternion.Set(0, 0, 0.7f, 0.7f);
transform.rotation = quaternion;
public void SetFromToRotation(Vector3 fromDirection, Vector3 toDirection);
摘要:Creates a rotation which rotates from fromDirection to toDirection. 创建一个从一个方向旋转到另一个方向的旋转。
public void SetLookRotation(Vector3 view);
public void SetLookRotation(Vector3 view, [DefaultValue("Vector3.up")] Vector3 up);
摘要:Creates a rotation with the specified forward and upwards directions. 创建具有指定正向和向上方向的旋转。
public override string ToString();
public string ToString(string format);
摘要:Returns a nicely formatted string of the Quaternion. 返回一个格式良好的四元数字符串。
public static Quaternion operator *(Quaternion lhs, Quaternion rhs);
public static Vector3 operator *(Quaternion rotation, Vector3 point);
public static bool operator ==(Quaternion lhs, Quaternion rhs);
public static bool operator !=(Quaternion lhs, Quaternion rhs);