Garry's Mod Wiki

Vector:DotProduct

  number Vector:DotProduct( Vector Vector )

Description

We advise against using this. It may be changed or removed in a future update. This is an alias of Vector:Dot. Use that instead.

Returns the dot product of the two vectors.

Arguments

1 Vector Vector
The other vector.

Returns

1 number
Dot Product

Example

A function to make sure the player is looking somewhere.

function IsLookingAt( ply, targetVec ) return ply:GetAimVector():DotProduct( ( targetVec - ply:GetPos() + Vector(70) ):GetNormalized() ) < 0.95 end
Output: Returns true if ply is looking at (or close to) the target.