四维向量的表示形式。
此结构用于在某些情况下表示四分量向量(例如网格切线、 着色器参数)。在大多数其他情况下,使用 Vector3。
negativeInfinity | 用于编写 Vector4(float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity) 的简便方法。 |
one | 用于编写 Vector4(1,1,1,1) 的简便方法。 |
positiveInfinity | 用于编写 Vector4(float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity) 的简便方法。 |
zero | 用于编写 Vector4(0,0,0,0) 的简便方法。 |
magnitude | 返回该向量的长度。(只读) |
normalized | 返回 magnitude 为 1 时的该向量。(只读) |
sqrMagnitude | 返回该向量的平方长度。(只读) |
this[int] | 分别使用 [0]、[1]、[2]、[3] 访问 x、y、z、w 分量。 |
w | 向量的 w 分量。 |
x | 向量的 X 分量。 |
y | 向量的 Y 分量。 |
z | 向量的 Z 分量。 |
Vector4 | 使用给定的 x、y、z、w 分量创建新向量。 |
Equals | 如果给定向量与该向量完全相等,则返回 true。 |
Set | 设置现有 Vector4 的 x、y、z 和 w 分量。 |
ToString | Returns a formatted string for this vector. |
Distance | 返回 a 与 b 之间的距离。 |
Dot | 两个向量的点积。 |
Lerp | 在两个向量之间进行线性插值。 |
LerpUnclamped | 在两个向量之间进行线性插值。 |
Max | 返回由两个向量的最大分量组成的向量。 |
Min | 返回由两个向量的最小分量组成的向量。 |
MoveTowards | 将点 current 移向 /target/。 |
Normalize | |
Project | 将向量投影到另一个向量上。 |
Scale | 将两个向量的分量相乘。 |
operator - | 将一个向量减去另一个向量。 |
operator * | 将向量乘以一个数值。 |
operator / | 将向量除以一个数值。 |
operator + | 将两个向量相加。 |
operator == | 如果两个向量大致相等,则返回 true。 |
Vector2 | Converts a Vector4 to a Vector2. |
Vector3 | 将 Vector4 转换为 Vector3。 |
Vector4 | 将 Vector3 转换为 Vector4。 |
Vector4 | 将 Vector2 转换为 Vector4。 |
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.