GetDistanceVec
Appearance
| Environment: | Mission Scripting | |
|---|---|---|
| Function: | getDistanceVec | |
| Function Description: | Calculates the 2D distance between two vectors, handling both vec2 and vec3 inputs by extracting x and z or y coordinates appropriately, then uses GetDistance2D to compute the distance in meters. | |
| File Location: | cmm.positionFunctions.lua | |
| Syntax: | CMM.getDistanceVec( table vec1 , table vec2 ) | |
| Return Value: | number | |
| Parameters: | Name | Description |
| vec1 | A vector table representing a point in 3D space, with fields x and optionally z or y; if z exists, it is treated as the y-coordinate for distance calculation. | |
| vec2 | A vector table representing a point in 3D space, with fields x and optionally z or y; if z exists, it is treated as the y-coordinate for distance calculation. | |
| Example: | CMM.getDistanceVec({x=1, y=2, z=3}, {x=4, y=5, z=6}) | |
| Example Description: | Computes the distance between two 3D points with coordinates (1,2,3) and (4,5,6), returning the 2D distance using x and z as the respective axes. | |
| Related Functions: | ||
| Notes: | --TODO Retire this command as CMM.Distance does the same thing | |