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.

Page Links


Special Pages


Wikis

?

Render Time: 77ms

DB GetPage 44
Generate Html 8
SaveChanges (1) 10
Render Body 0
Render Sidebar 13