Skip to content

Api > Matrix4x4 > LookAt()


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

Create a "look at" matrix.

Parameters:⚓︎

Name Type Description
from Vector3 The source point.
to Vector3 The target point.
up Vector3 The vector describing the up direction (typically Vector3.up).

Returns:⚓︎

type Description
Matrix4x4 The 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.