Mat4:target

Edit

Sets a model transform matrix that moves to from and orients model towards to point.

This is used when rendered model should always point towards a point of interest. The resulting Mat4 object can be used as model pose.

The target() function produces same result as lookAt() after matrix inversion.

self = Mat4:target(from, to, up)

Arguments

NameTypeDefaultDescription
fromVec3 The position of the viewer.
toVec3 The position of the target.
upVec3Vec3(0, 1, 0) The up vector of the viewer.

Returns

NameTypeDescription
selfMat4 The modified matrix.

See also