-
Tutorials Math/Vectors
Hey,
does anybody know a good tutorials about the math behind vectors?
Some people are interested to work on K~Surf, but they lack the math-skills atm.
Regards
Collection of Tutorials:
Bullettrace and you
http://killtube.org/showthread.php?8...ghlight=vector
[advanced] movegravity() and movement vectors
http://killtube.org/showthread.php?8...ghlight=vector
-
You mean something like this:
A vector in cod is (x,y,z) = (forward, left/right, up). The most used function with vectors in cod are distance, VectorNormalize and VectorToAngles.
With distance you can calcatulate the distance between two points.
Example:
Code:
one = (0,0,0);
two = (100, 0, 100);
dist = Distance( one, two );
With VectorNormalize you get a vector between 0 and 1. So (0-1, 0-1, 0-1).
Example:
Code:
difference = VectorNormalize( end - start );
With VectorToAngles you can calculate the angles you need to get from your current position (vector) to a other position.
Example:
Code:
angles = VectorToAngles( end - start );
-
Yeah, thats already a good beginning :)
-
Nope, vectornormalize does actually the following:
Code:
vec = (123, 234, 345);
vec = vectornormalize(vec);
}
vectornormalize(vector)
{
l = length(vector);
vector = maps\mp\_utility::vectorScale(vector, 1/l);
}
As you can see, vectornormalize will a vector with exactly the same direction, but with length of one. Always. (although behaviour with vec = (0,0,0) is not defined)