跳至正文
版本:最新版 - a1.156.0 ⚖️

🧮 Matrix

由旋转和原点构建的 4x4 变换矩阵,可用于几何和位置计算。主要在内部使用。


🎒 示例​

-- Builds a matrix rotated 90 degrees in Yaw, placed at (100, 0, 0)
local matrix = Matrix(Rotator(0, 90, 0), Vector(100, 0, 0))

-- Rotates a direction by the matrix rotation (the origin is not applied)
local rotated_direction = matrix:TransformVector(Vector(50, 0, 0))

🛠 Constructors​

Default Constructor​

No description provided

local my_matrix = Matrix(rotation, origin)

Parameters

TypeNameDefaultDescription
Rotatorrotation Required parameter 矩阵的旋转
Vectororigin Required parameter 矩阵的原点

🦠 Functions​

ReturnsNameDescription
VectorTransformVector按此矩阵的旋转来旋转向量(不应用原点)
MatrixGetTransposed返回一个转置后的新矩阵(维基百科)

Optimal

TransformVector​

按此矩阵的旋转来旋转向量(不应用原点)
local ret = my_matrix:TransformVector(vector)

Parameters

TypeParameterDefaultDescription
Vectorvector Required parameter 要进行变换的向量

Returns

TypeDescription
Vector新向量

Optimal

GetTransposed​

返回一个转置后的新矩阵(维基百科)
local ret = my_matrix:GetTransposed()

Returns

TypeDescription
Matrix转置后的矩阵