Vector/DotProduct

From Garry's Mod
Jump to: navigation, search
 Vector:DotProduct( )

Contents

Description

This feature is deprecated.
You should avoid using it as it may be removed in a future version.

This is an alias of Vector:Dot. Use that instead.
Returns the dot product of the two vectors.

Arguments

Vector Vector

The other vector.

Returns

number

Dot Product

Examples

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.
Personal tools
Navigation