Skip to main content
A 3D vector: world positions, directions, velocities. Global class, no import.
Fields are 32-bit floats; assigning a non-number or NaN throws.

Overview

Common

from, set, add, lerp, normalize…

Length and distance

length, distTo, dot, cross, 2D variants.

Angles

toAngles, angleTo.

Common

Every argument takes any Vec3Like, not just a Vector. Only set() and normalize() change the value. Nothing changes its arguments.

Length and distance

The 2D variants ignore z, which is what you want for horizontal distance on a map.

Angles

Engine convention, in degrees: pitch positive looks down. See QAngle.

toAngles


The view angles that look along this direction, roll 0.

angleTo


The view angles that aim from this point at target. Same as target.sub(this).toAngles().
For screen positions use render.worldToScreen, not angles.

Example

Finds the enemy whose head is closest to the crosshair and circles it.