GetDistanceBetweenPoints3D: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Server function}} | |||
__NOTOC__ | __NOTOC__ | ||
This function returns the distance between two | This function returns the distance between two 3D points using the pythagorean theorem. | ||
==Syntax== | ==Syntax== | ||
Line 18: | Line 19: | ||
==Example== | ==Example== | ||
This example gets the distance between two vehicles and outputs it to the chat box. | This example gets the distance between two vehicles and outputs it to the chat box. | ||
<syntaxhighlight lang="lua">vehicle1x, vehicle1y, vehicle1z = getElementPosition ( vehicle ) | <syntaxhighlight lang="lua"> | ||
vehicle1x, vehicle1y, vehicle1z = getElementPosition ( vehicle ) | |||
vehicle2x, vehicle2y, vehicle2z = getElementPosition ( vehicle2 ) | vehicle2x, vehicle2y, vehicle2z = getElementPosition ( vehicle2 ) | ||
outputChatBox ( "The distance between vehicle1 and vehicle2 is ", getDistanceBetweenPoints3D ( vehicle1x, vehicle1y, vehicle1z, vehicle2x, vehicle2y, vehicle2z ) )</syntaxhighlight> | outputChatBox ( "The distance between vehicle1 and vehicle2 is ", getDistanceBetweenPoints3D ( vehicle1x, vehicle1y, vehicle1z, vehicle2x, vehicle2y, vehicle2z ) )</syntaxhighlight> |
Revision as of 15:22, 20 August 2007
This function returns the distance between two 3D points using the pythagorean theorem.
Syntax
float getDistanceBetweenPoints3D ( float x1, float y1, float z1, float x2, float y2, float z2 )
Required Arguments
- x1: The X position of the first point
- y1: The Y position of the first point
- z1: The Z position of the first point
- x2: The X position of the second point
- y2: The Y position of the second point
- z2: The Z position of the second point
Returns
Returns the distance between the two points as a float. Returns false if an argument passed was invalid.
Example
This example gets the distance between two vehicles and outputs it to the chat box.
vehicle1x, vehicle1y, vehicle1z = getElementPosition ( vehicle ) vehicle2x, vehicle2y, vehicle2z = getElementPosition ( vehicle2 ) outputChatBox ( "The distance between vehicle1 and vehicle2 is ", getDistanceBetweenPoints3D ( vehicle1x, vehicle1y, vehicle1z, vehicle2x, vehicle2y, vehicle2z ) )
See Also
- addDebugHook
- base64Decode
- base64Encode
- debugSleep
- decodeString
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimerDetails
- getTimers
- getFPSLimit
- getUserdataType
- getVersion
- gettok
- isTransferBoxVisible
- setTransferBoxVisible
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setTimer
- ref
- deref
- sha256
- split
- teaDecode
- teaEncode
- toJSON
- tocolor
- getProcessMemoryStats
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace