Distance
Appearance
| Environment: | Mission Scripting | |
|---|---|---|
| Function: | Distance | |
| Function Description: | Calculates the distance between two 2D or 3D vectors, using 3D distance if both vectors have z components, otherwise using 2D distance. | |
| File Location: | cmm.positionFunctions.lua | |
| Syntax: | CMM.Distance( table vecA , table vecB ) | |
| Return Value: | number or nil | |
| Parameters: | Name | Description |
| vecA | {x <number>, y <number>, z <number>} – first vector, must have x and y components, z optional. | |
| vecB | {x <number>, y <number>, z <number>} – second vector, must have x and y components, z optional. | |
| Example: | CMM.Distance({x=10, y=20}, {x=30, y=40}) | |
| Example Description: | Calculates the 2D distance between two points with x and y coordinates. | |
| Related Functions: | ||
| Notes: | ||