使用整数的 3D 向量和点表示形式。
此结构用于在某些情况下表示不需要浮点精度的 3D 位置和向量。
down | 用于编写 Vector3Int (0, -1, 0) 的简便方法。 |
left | 用于编写 Vector3Int (-1, 0, 0) 的简便方法。 |
one | 用于编写 Vector3Int (1, 1, 1) 的简便方法。 |
right | 用于编写 Vector3Int (1, 0, 0) 的简便方法。 |
up | 用于编写 Vector3Int (0, 1, 0) 的简便方法。 |
zero | 用于编写 Vector3Int (0, 0, 0) 的简便方法。 |
magnitude | 返回该向量的长度。(只读) |
sqrMagnitude | 返回该向量的平方长度。(只读) |
this[int] | 分别使用 [0]、[1] 或 [2] 访问 y、y 或 z 分量。 |
x | 向量的 X 分量。 |
y | 向量的 Y 分量。 |
z | 向量的 Z 分量。 |
Clamp | 将 Vector3Int 限制在 min 和 max 给定的边界内。 |
Equals | 如果对象相等,则返回 true。 |
GetHashCode | 获取 Vector3Int 的哈希代码。 |
Set | 设置现有 Vector3Int 的 x、y 和 z 分量。 |
ToString | 对于该向量,返回整齐格式化的字符串。 |
CeilToInt | 通过对每个值执行 Ceiling 操作将 Vector3 转换为 Vector3Int。 |
Distance | 返回 a 与 b 之间的距离。 |
FloorToInt | 通过对每个值执行 Floor 操作将 Vector3 转换为 Vector3Int。 |
Max | 返回由两个向量的最大分量组成的向量。 |
Min | 返回由两个向量的最小分量组成的向量。 |
RoundToInt | 通过对每个值执行 Round 操作将 Vector3 转换为 Vector3Int。 |
Scale | 将两个向量的分量相乘。 |
operator - | 将一个向量减去另一个向量。 |
operator != | 如果向量不同,则返回 true。 |
operator * | 将向量乘以一个数值。 |
operator / | 将向量除以一个数值。 |
operator + | 将两个向量相加。 |
operator == | 如果向量相等,则返回 true。 |
Unknown operator | 将 Vector3Int 转换为 Vector2Int。 |
Vector3 | 将 Vector3Int 转换为 Vector3。 |
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.