Skip to content

Documentation / @ripl/3d / mat4LookAt

Function: mat4LookAt() ​

mat4LookAt(eye, target, up): Matrix4

Defined in: 3d/src/math/matrix.ts:145

Constructs a view matrix looking from eye toward target with the given up direction.

Degenerate inputs are defended rather than silently collapsed: an eye equal to target yields the identity, and an up parallel to the view direction falls back to a perpendicular axis. Both previously produced a rank-deficient matrix that projected every point to the viewport centre.

Parameters ​

ParameterType
eyeVector3
targetVector3
upVector3

Returns ​

Matrix4