lookAt

fun lookAt(result: ZMatrix4, eye: ZVector3, look: ZVector3, up: ZVector3)(source)

Builds a rotation-only orthonormal right-handed 4x4 matrix suitable for object orientation: column 0 = world direction of local +X (ZVector3.Right), column 1 = world direction of local +Y (ZVector3.Up), column 2 = world direction of local +Z (ZVector3.Forward): normalized (look - eye).

Satisfies Forward × Right = Up in world space (matches engine basis). The up hint is projected onto the plane perpendicular to forward (Gram–Schmidt); if it is parallel to forward, a stable fallback axis is used.

Translation is cleared; last row is (0, 0, 0, 1). For a degenerate direction (look ≈ eye), result is set to identity.

Parameters

result

Output matrix.

eye

World position of the object (used only to compute the view direction look - eye).

look

World point to face.

up

World up hint (need not be unit or orthogonal to the view direction).