lovr.math.mat4

Creates a new mat4.

Note that this function is also a table containing the __index key of the mat4 metatable. This means that you can add your own functions onto the lovr.math.mat4 table to extend the built-in functionality.

Sets the matrix to the identity matrix.

m = lovr.math.mat4()

Arguments

None

Returns

NameTypeDescription
mmat4The new matrix.

Copies values from an existing matrix.

m = lovr.math.mat4(n)

Arguments

NameTypeDescription
nmat4An existing matrix to copy the values from.

Returns

NameTypeDescription
mmat4The new matrix.

m = lovr.math.mat4(position, scale, rotation)

Arguments

NameTypeDefaultDescription
positionvec30, 0, 0The translation of the matrix.
scalevec31, 1, 1The scale of the matrix.
rotationquat0, 0, 0, 0The rotation of the matrix.

Returns

NameTypeDescription
mmat4The new matrix.

m = lovr.math.mat4(...)

Arguments

NameTypeDescription
...number16 numbers to use as the raw values of the matrix (column-major).

Returns

NameTypeDescription
mmat4The new matrix.

Notes

This function takes the same arguments as mat4:set.

See also