Static
Readonly
DOWNStatic
Readonly
LEFTStatic
Readonly
ONEStatic
Readonly
RIGHTStatic
Readonly
UPStatic
Readonly
ZEROGet the absolute values of components 获取分量的绝对值
Add in place (modifies this instance for better performance) 就地相加(修改当前实例以提高性能)
Get the angle of this vector from the positive X axis 获取此向量相对于正X轴的角度
Create a copy of this vector 创建此向量的副本
Calculate cross product with another vector (returns scalar for 2D) 计算与另一个向量的叉积(2D返回标量)
Divide in place (modifies this instance for better performance) 就地相除(修改当前实例以提高性能)
Calculate the magnitude (length) of the vector 计算向量的大小(长度)
Multiply in place (modifies this instance for better performance) 就地相乘(修改当前实例以提高性能)
Negate the vector 取向量的负值
Normalize the vector (make it unit length) 归一化向量(使其长度为1)
Get a vector perpendicular to this one (rotated 90 degrees counter-clockwise) 获取垂直于此向量的向量(逆时针旋转90度)
Get the right perpendicular vector (rotated 90 degrees clockwise) 获取右垂直向量(顺时针旋转90度)
Project this vector onto another vector 将此向量投影到另一个向量上
The vector to project onto
The projected vector
Reflect this vector across a normal vector 沿法向量反射此向量
The normal vector to reflect across (should be normalized)
The reflected vector
Get the component of this vector perpendicular to another vector 获取此向量垂直于另一个向量的分量
The vector to get the perpendicular component relative to
The perpendicular component
Reset this vector to zero (for object pooling) 将此向量重置为零(用于对象池)
Rotate this vector by the given angle in radians 将此向量按给定角度(弧度)旋转
Angle in radians
The rotated vector
Set this vector's components from coordinates (for reusing objects) 从坐标设置此向量的分量(用于重用对象)
Set this vector's components from another vector (for reusing objects) 从另一个向量设置此向量的分量(用于重用对象)
Calculate squared distance to another vector (more efficient) 计算到另一个向量的平方距离(更高效)
Calculate the squared magnitude (more efficient than magnitude) 计算平方大小(比magnitude更高效)
Subtract in place (modifies this instance for better performance) 就地相减(修改当前实例以提高性能)
Convert to array [x, y] 转换为数组 [x, y]
Convert to string representation 转换为字符串表示
Static
angleCalculate angle between two vectors in radians using deterministic math 使用确定性数学计算两个向量之间的角度(弧度)
Static
fromCreate a vector from angle and magnitude 从角度和大小创建向量
Static
lerpLinear interpolation between two vectors 两个向量之间的线性插值
2D Vector using fixed-point arithmetic for deterministic calculations 使用定点算术的2D向量,用于确定性计算