lovr.math.newMat4

Creates a new 4D matrix. This function takes the same arguments as Mat4:set.


Sets the matrix to the identity matrix.

m = lovr.math.newMat4()

Arguments

None

Returns

NameTypeDescription
mMat4 The new matrix.

Copies the values from an existing matrix.

m = lovr.math.newMat4(n)

Arguments

NameTypeDescription
nmat4 An existing matrix to copy the values from.

Returns

NameTypeDescription
mMat4 The new matrix.

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

Arguments

NameTypeDefaultDescription
positionVec30, 0, 0 The translation of the matrix.
scaleVec31, 1, 1 The scale of the matrix.
rotationQuat0, 0, 0, 1 The rotation of the matrix.

Returns

NameTypeDescription
mMat4 The new matrix.

m = lovr.math.newMat4(position, rotation)

Arguments

NameTypeDefaultDescription
positionVec30, 0, 0 The translation of the matrix.
rotationQuat0, 0, 0, 1 The rotation of the matrix.

Returns

NameTypeDescription
mMat4 The new matrix.

m = lovr.math.newMat4(...)

Arguments

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

Returns

NameTypeDescription
mMat4 The new matrix.

Sets the diagonal values to a number and everything else to 0.

m = lovr.math.newMat4(d)

Arguments

NameTypeDescription
dnumber A number to use for the diagonal elements.

Returns

NameTypeDescription
mMat4 The new matrix.

See also