Skip to main content

Matrix4x4.LookAt(Vector3 from, Vector3 to, Vector3 up)

Create a "look at" matrix.

Parameters:

NameTypeDescription
fromVector3The source point.
toVector3The target point.
upVector3The vector describing the up direction (typically Vector3.up).

Returns:

typeDescription
Matrix4x4The resulting transformation matrix.

Usage

---@type Vector3
local from;

---@type Vector3
local to;

---@type Vector3
local up;


local val0 = Matrix4x4:LookAt(from, to, up)

Extra Detail

Given a source point, a target point, and an up vector, computes a transformation matrix that corresponds to a camera viewing the target from the source, such that the right-hand vector is perpendicular to the up vector.