GetDistance2D: Difference between revisions

From Onset Developer Wiki
(Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|GetDistance2D(x, y, x2, y2)}} {{FuncParameters}} {{FuncParam|x|__EDIT_ME__}} {{FuncParam|y|__EDIT_...")
 
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server & Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Calculates the distance between 2 points.}}


{{FuncSyntax|GetDistance2D(x, y, x2, y2)}}
{{FuncSyntax|GetDistance2D(x, y, x2, y2)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|x|__EDIT_ME__}}
{{FuncParam|x|x of the first point.}}
{{FuncParam|y|__EDIT_ME__}}
{{FuncParam|y|y of the first point.}}
{{FuncParam|x2|__EDIT_ME__}}
{{FuncParam|x2|x of the second point.}}
{{FuncParam|y2|__EDIT_ME__}}
{{FuncParam|y2|y of the second point.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|The distance between the 2 points.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
local distance = GetDistance2D(0, 0, 100, 100) -- Returns 100
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[GetDistance3D]]
* [[GetDistanceSquared3D]]

Latest revision as of 16:00, 2 August 2021

GetDistance2D

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Calculates the distance between 2 points.

Syntax

GetDistance2D(x, y, x2, y2)

Parameters

  • x
    x of the first point.
  • y
    y of the first point.
  • x2
    x of the second point.
  • y2
    y of the second point.

Return Value

  • The distance between the 2 points.

Example

local distance = GetDistance2D(0, 0, 100, 100) -- Returns 100

See also