A vector has three components, vx, vy and vz.
A Unit Vector is a vector which has a length of one. In Net Yaroze terms, ONE is defined as 4096.
Normalizing a vector.
Normalizing a vector simply takes any vector and turns it into a unit vector. This is achieved by dividing each of it's components by the vector's length.
If vect is a VECTOR, then calculate it's size from:
magnitude = sqrt(vect.vx * vect.vx + vect.vy * vect.vy + vect.vz * vect.vz);
Then make vect a unit vector by: (assuming magnitude != 0)
vect.vx/=magnitude;
vect.vy/=magnitude;
vect.vz/=magnitude;
Dot Product.
The dot product of two vectors is simply the cosine of the angle between them. (Also called the Scalar product)
cos (t) = (a.vx * b.vx + a.vy * b.vy + a.vz * b.vz) / sqrt((a.vx*a.vx + a.vy*a.vy + a.vz*a.vz) * (b.vx*b.vx + b.vy*b.vy + b.vz*b.vz))
Cross Product.
The cross product of two vectors is a vector which is at right angles to both original vectors.
The notation for this is:
c = a x b
where a, b and c are all vectors. This is equivalent to:
c.vx = a.vx * b.vz - a.vz * b.vy
c.vy = a.vz * b.vx - a.vx * b.vz
v.vz = a.vx * b.vy - a.vy * b.vx
You may need to normalize this resultant vector if you are creating normals.