Vector:Dot
Description
Returns the dot product of this vector and the passed one.
The dot product of two vectors is the product of their magnitudes (lengths), and the cosine of the angle between them:
a · b = |a| |b| cos(θ)
where a and b are vectors.
See Vector:Length for obtaining magnitudes.
A dot product returns just the cosine of the angle if both vectors are normalized, and zero if the vectors are at right angles to each other.
Arguments
Returns
Example
Get the angle of two opposite normalized vectors.
Degrees 180
Example
Calculates whether the player is looking in the direction of an entity. This is often faster than traces, but it produces a slightly different result.
The player is looking in the direction of the entity if the angle between the aimvector and the vector from the player to the entity is less than 22.5 degrees (or pi / 8 radians).
Example
A function to make sure the player is looking somewhere.