Vector.Distance

From GMod Wiki

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


Examples

DescriptionReturns the distance between the two players (So if victim is at 100,100,500, and target is at 100,100,200)
Used onNewerShared.png
Code
local victimpos = player.GetByID( 1 ):GetPos()
local targetpos = player.GetByID( 2 ):GetPos()
return victimpos:Distance( targetpos )
Output300


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox