クォータニオンは回転を表すのに使用されます。
クォータニオンはコンパクトで、ジンバルロックに悩まされず、簡単に補間することができます。
Unity は内部的に使用され、すべての回転を表せます。
クォータニオンは複素数に基づいており、直感的に理解するのは容易ではありません。個々のクォータニオンの成分 (x,y,z,w) にアクセスしたり変更したりすることはほとんどありません。たいてい、既存の回転 (例えば、Transform から取得) を使用して新しい回転を構築するために使用します (例えば、2 つのローテーションの間を円滑に補間するなど)。使用する Quaternion 関数の 99% は、Quaternion.LookRotation、Quaternion.Angle、Quaternion.Euler、Quaternion.Slerp、Quaternion.FromToRotation、Quaternion.identity です (他の関数が使用されることはほとんどありません)。
Quaternion.operator * を使用して、1 つの回転をもう 1 つの回転でさらに回転させたり、ベクトルを回転によって回転させることができます。
Unity はクォータニオンは正規化されることを前提としています。
identity | 単位回転 (読み込みのみ可) |
eulerAngles | Returns or sets the euler angle representation of the rotation. |
normalized | 大きさ 1 でこのクオータニオンを返します (読み込み専用) |
this[int] | イデックスによって x、y、z、w にアクセスする。 |
w | W component of the Quaternion. Do not directly modify quaternions. |
x | クォータニオンの x 成分。クォータニオンを熟知していない限り、この値を直接変更しないでください。 |
y | クォータニオンの Y 成分。クォータニオンを熟知していない限り、この値を直接変更しないでください。 |
z | クォータニオンの Z 成分。クォータニオンを熟知していない限り、この値を直接変更しないでください。 |
Quaternion | 与えられた x、y、z、w 成分で新規のクォータニオンを作成します。 |
Set | 既存の Quaternion に x、y、z、w の成分を設定します |
SetFromToRotation | fromDirection から toDirection への回転を作成します。 |
SetLookRotation | 指定された forward と upwards 方向に回転します。 |
ToAngleAxis | 回転を座標に対する角度の値 (AngleAxis) に変換します。 |
ToString | Returns a formatted string for this quaternion. |
Angle | 2 つの回転 a と b 間の角度を返します。 |
AngleAxis | axis の周りを angle 度回転する回転を作成します。 |
Dot | 2 つの回転の内積を返します。 |
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; applied in that order. |
FromToRotation | fromDirection から toDirection への回転を作成します。 |
Inverse | /rotation/の逆クォータニオンを返します。 |
Lerp | a と b の間を t で補間し、その後、その結果を正規化します。パラメーター t は、[0, 1] の範囲です。 |
LerpUnclamped | a と b の間を t で補間し、その後、その結果を正規化します。パラメーター t は[0,1]の範囲にクランプされていません。 |
LookRotation | 指定された forward と upwards 方向に回転します。 |
Normalize | Converts this quaternion to one with the same orientation but with a magnitude of 1. |
RotateTowards | from から to への回転を得ます。 |
Slerp | Spherically interpolates between quaternions a and b by ratio t. The parameter t is clamped to the range [0, 1]. |
SlerpUnclamped | a と b の間を t で球状に補間します。パラメーター t は、限られていません。 |
operator * | lhs と rhs の回転を組合わせます。 |
operator == | 2 つのクォータニオンは互いに一致するかどうか |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.