lovr.math.newQuat

Creates a new quaternion. This function takes the same arguments as Quat:set.


q = lovr.math.newQuat(angle, ax, ay, az, raw)

Arguments

NameTypeDefaultDescription
anglenumber0 An angle to use for the rotation, in radians.
axnumber0 The x component of the axis of rotation.
aynumber0 The y component of the axis of rotation.
aznumber0 The z component of the axis of rotation.
rawbooleanfalse Whether the components should be interpreted as raw (x, y, z, w) components.

Returns

NameTypeDescription
qquat The new quaternion.

q = lovr.math.newQuat(r)

Arguments

NameTypeDescription
rquat An existing quaternion to copy the values from.

Returns

NameTypeDescription
qquat The new quaternion.

Uses the direction of a vector.

q = lovr.math.newQuat(v)

Arguments

NameTypeDescription
vvec3 A normalized direction vector.

Returns

NameTypeDescription
qquat The new quaternion.

Sets the rotation to represent the rotation between two vectors.

q = lovr.math.newQuat(v, u)

Arguments

NameTypeDescription
vvec3 A normalized direction vector.
uvec3 Another normalized direction vector.

Returns

NameTypeDescription
qquat The new quaternion.

q = lovr.math.newQuat(m)

Arguments

NameTypeDescription
mmat4 A matrix to use the rotation from.

Returns

NameTypeDescription
qquat The new quaternion.

Set the quaternion to the identity (0, 0, 0, 1).

q = lovr.math.newQuat()

Arguments

None

Returns

NameTypeDescription
qquat The new quaternion.

See also