Skip to main content
View angles in degrees, engine convention. Global class, no import.
Pitch positive looks down, yaw turns counter-clockwise from +X, roll spins around the view direction. Fields are 32-bit floats; assigning a non-number or NaN throws.

Overview

Common

from, set, add, lerp, normalize…

Wrapping

normalize, clamp.

Direction

forward, right, up, fovTo, toQuaternion.

Common

Every argument takes any AngleLike, not just a QAngle. Only set() and normalize() change the value. Nothing changes its arguments. clamp() changes the value too. equals compares raw components without wrapping, so normalize both sides first.

lerp


Blends each component along the shorter arc, so 170 → -170 passes through 180, not 0. t isn’t clamped and the result isn’t wrapped.

Wrapping

normalize


Wraps every component into [-180, 180]. normalize() changes the angle, normalized() returns a copy.

clamp


Makes it a valid view angle: pitch wrapped then clamped to [-89, 89], yaw wrapped into [-180, 180], roll 0. clamp() changes the angle, clamped() returns a copy.
Clamp anything you compute before using it as view angles. add, sub and lerp don’t wrap.

Direction

forward


Unit vectors of the view. forward() is where the crosshair points.

fovTo


The real angle between the two view directions, 0–180 degrees. This is the aimbot “FOV” to a target.
Get the target angles with Vector.angleTo.

toQuaternion


The same rotation as a Quaternion.

Example

Lists enemies by how far left or right of your view they are.