Large worlds · function
cameraPositionFrom
Where the camera is, out of a view matrix, into out.
Explained in Coordinates and units.
function cameraPositionFrom(view: ArrayLike<number>, out: Float64Array): voidimport { cameraPositionFrom } from '@driftengine/core';Parameters
| Parameter | Type | Description |
|---|---|---|
view | ArrayLike<number> | |
out | Float64Array |
In depth
A view matrix is R · T(−p), so its translation column is in view space and negating it is
right only while the camera is unrotated. The camera's world position is −Rᵀ · t, and the
transpose is the inverse because a view rotation is orthonormal. Getting this wrong is invisible
in any test whose camera is not turned, and wrong by the whole camera offset in every other.
Column-major, as gl-matrix writes one: m[0..2] is the first column.