-
Notifications
You must be signed in to change notification settings - Fork 0
Matrices
HanamileH edited this page Apr 6, 2024
·
1 revision
Matrices allow you to perform transformations on points and vectors, their behavior generally coincides with the behavior in linear algebra. The size of the matrices is always 4x4. The W component of the vectors is always considered equal to 1, this allows you to create displacement matrices.
-
matrix.new(<mat>)
Creating a new matrix from a 4x4 table. If the table is not specified, a standard matrix is used. -
matrix.rotationX([angle])
matrix.rotationY([angle])
matrix.rotationZ([angle])
Creating an object rotation matrix at a given angle around the corresponding axis. The angle is given in radians. -
matrix.quatRotation([x], [y], [z], [w])
Creating a rotation matrix using quaternions. Take a look at the Internet for more information. -
matrix.translation([position vector])
ormatrix.translation([x], [y], [z])
Creating a displacement matrix. The input argument can be either a vector or 3 numbers denoting each coordinate. -
matrix.scale([scale vector])
ormatrix.scale([x], <y>, <z>)
The scaling matrix. Designed to zoom in or out of objects. The input argument can be either 1 number indicating the overall scale, or a vector or 3 numbers indicating the scale along each axis. -
matrix.projection()
As the name suggests, this is a projection matrix. It allows you to translate the world into a perspective projection. -
matrix.camera(<pitch>, <yaw>, <roll>, <position>)
Creating a matrix that combines movement, rotation and projection, It allows you to create a matrix in one action that transforms the world into screen space, taking into account the rotation and position of the camera. If no arguments are specified, the values fromAra.camera
are used.