Jump to content

Distance3D

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: Distance3D
Function Description: Calculates the 3D distance between two vectors, each defined by x, y, and z components, returning the magnitude of the vector difference.
File Location: cmm.positionFunctions.lua
Syntax: CMM.Distance3D( table vec3_1 , table vec3_2 )
Return Value: number or nil
Parameters: Name Description
vec3_1{x <number>, y <number>, z <number>} – first 3D vector, must have all three components.
vec3_2{x <number>, y <number>, z <number>} – second 3D vector, must have all three components.
Example: CMM.Distance3D({x=10, y=20, z=30}, {x=40, y=50, z=60})
Example Description: Computes the 3D distance between two points with full x, y, and z coordinates, returning the magnitude of the vector difference.
Related Functions:
Notes: