Jump to content

GetDir

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: getDir
Function Description: Calculates the bearing in degrees from an initial vector to a destination vector using the atan2 function, adjusting for proper quadrant representation and returning a value between 0 and 360 degrees.
File Location: cmm.positionFunctions.lua
Syntax: CMM.getDir( table InitialVec , table DestinationVec )
Return Value: number
Parameters: Name Description
InitialVecA vector table with x and optionally z or y components, representing the starting position or direction.
DestinationVecA vector table with x and optionally z or y components, representing the target position or direction.
Example: CMM.getDir({x=0, y=0}, {x=1, y=1})
Example Description: Computes the bearing from origin to point (1,1), returning 45 degrees, demonstrating accurate direction calculation with proper component handling.
Related Functions:
Notes: