Vector

From QuakeQEWiki
Jump to navigation Jump to search

Quake-C vectors are 3-dimensional vectors of floats. These are often used to represent a specific point in 3D space, a direction in 3D space, or a set of rotations.

Operations[edit | edit source]

Dot Product[edit | edit source]

vector a, b;

float dp = a * b;

Addition[edit | edit source]

vector a, b;

vector c = a + b;

Scaling[edit | edit source]

vector a;

a = a * 3.5;

Length[edit | edit source]

vector a;

float length = vlen(a);

To String[edit | edit source]

vector a;

brpint( vtos( a ) );

Member Access[edit | edit source]

The individual floating point values of a vector can be accessed with _x, _y, or _z appended to the end of the variable name:

self.velocity_x = (random() - 0.5) * 600;

Trivia[edit | edit source]

Vectors are initialized