言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

Quaternion

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Quaternions are used to represent rotations.

コンパクトであり、ジンバル ロックの問題がなく、簡単に補間できます。 Unity は全ての回転を表現するのにクォータニオンを内部的に使用します。 しかし複雑な数字にもとづいており、直感的でない側面があります。 このため個別のクォータニオン成分 (x,y,z,w) をアクセスまたは修正することは殆どありません。 主に既存の回転(例. Transform など)にもとづき 新規の回転を作成します(例.二つの回転の間をスムーズに補間させる) 使用する Quaternion 関数の 99% は以下です: Quaternion.LookRotation, Quaternion.Angle, Quaternion.Euler, Quaternion.Slerp, Quaternion.FromToRotation, Quaternion.identity (他の関数は極めて稀な用途) Quaternion.operator * を使用してひとつの回転を別のものにより回転させる、またはベクトルを回転により回転させることが出来ます。

Static Variables

identity The identity rotation (Read Only). This quaternion corresponds to "no rotation": the object.

Variables

eulerAngles Returns the euler angle representation of the rotation.
this[int] イデックスによってx,y,z,wにアクセスする。
w W component of the Quaternion. Don't modify this directly unless you know quaternions inside out.
x X component of the Quaternion. Don't modify this directly unless you know quaternions inside out.
y Y component of the Quaternion. Don't modify this directly unless you know quaternions inside out.
z Z component of the Quaternion. Don't modify this directly unless you know quaternions inside out.

Constructors

Quaternion Constructs new Quaternion with given x,y,z,w components.

Functions

Set Set x, y, z and w components of an existing Quaternion.
SetFromToRotation Creates a rotation which rotates from fromDirection to toDirection.
SetLookRotation Creates a rotation with the specified forward and upwards directions.
ToAngleAxis Converts a rotation to angle-axis representation.
ToString Returns a nicely formatted string of the Quaternion.

Static Functions

Angle Returns the angle in degrees between two rotations a and b.
AngleAxis Creates a rotation which rotates angle degrees around axis.
Dot The dot product between two rotations.
Euler 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).
FromToRotation Creates a rotation which rotates from fromDirection to toDirection.
Inverse Returns the Inverse of rotation.
Lerp Interpolates between from and to by t and normalizes the result afterwards.
LookRotation Creates a rotation with the specified forward and upwards directions.
RotateTowards Rotates a rotation from towards to.
Slerp Spherically interpolates between from and to by t.

Operators

operator != 二つのクォータニオンが互いに一致するか?
operator * lhs および lhs の回転を組合わせます。
operator == 二つのクォータニオンは互いに異なるか?