Vector
Revision as of 07:37, 17 February 2022 by Teamred (talk | contribs) (Created page with "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 == === Dot Product === <code>vector a, b;</code> <code>float dp = a * b;</code> === Addition === <code>vector a, b;</code> <code>vector c = a + b;</code> === Scaling === <code>vector a;</code> <code>a = a * 3.5;</code> === Length === <code>vector a;</code> <code>float lengt...")
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