Garry's Mod Wiki

Garry's Mod Wiki

  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.

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...