Vector.DotProduct

From GMod Wiki

(Redirected from Vector.Dot)
Jump to: navigation, search
Function
Syntax Vector:DotProduct( Vector )
Description:
Returns the dot product of the 2 vectors.
Returns: Float
In Object: Vector
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Vector.DotProduct]Vector.DotProduct [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionMakes it so you only pick up weapons if you are looking in its general direction while holding the use button.
Used onNewerServer.png
Code
function GM:PlayerCanPickupWeapon( player, entity )
 
	return ( player:KeyDown(IN_USE) && player:GetAimVector():DotProduct( ( entity:GetPos() - player:GetPos() ):Normalize() ) < 0.90 )
 
end
OutputN/A

Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox