Quat:set

Sets the components of the quaternion. There are lots of different ways to specify the new components, the summary is:

q = Quat:set(angle, ax, ay, az, raw)

Arguments

NameTypeDefaultDescription
angle0The angle to use for the rotation, in radians.
axnumber0The x component of the axis of rotation.
aynumber0The y component of the axis of rotation.
aznumber0The z component of the axis of rotation.
rawbooleanfalseWhether the components should be interpreted as raw (x, y, z, w) components.

Returns

NameTypeDescription
qquatThe original quaternion.

q = Quat:set(angle, axis)

Arguments

NameTypeDefaultDescription
angle0The angle to use for the rotation, in radians.
axisvec3The axis of rotation (does not need to be normalized).

Returns

NameTypeDescription
qquatThe original quaternion.

q = Quat:set(r)

Arguments

NameTypeDescription
rquatAn existing quaternion to copy the values from.

Returns

NameTypeDescription
qquatThe original quaternion.

Sets the values from a direction vector.

q = Quat:set(v)

Arguments

NameTypeDescription
vvec3A normalized direction vector.

Returns

NameTypeDescription
qquatThe original quaternion.

Sets the values to represent the rotation between two vectors.

q = Quat:set(v, u)

Arguments

NameTypeDescription
vvec3A normalized direction vector.
uvec3Another normalized direction vector.

Returns

NameTypeDescription
qquatThe original quaternion.

q = Quat:set(m)

Arguments

NameTypeDescription
mmat4A matrix to use the rotation from.

Returns

NameTypeDescription
qquatThe original quaternion.

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

q = Quat:set()

Arguments

None

Returns

NameTypeDescription
qquatThe original quaternion.

See also