Jump to content

RelativePosition

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: RelativePosition
Function Description: Computes a new position relative to a given vector, offset by a specified bearing and distance in meters, adjusting the y-coordinate using terrain height at the calculated x-z point.
File Location: cmm.positionFunctions.lua
Syntax: CMM.RelativePosition( table vec3 , number bearing , number distance )
Return Value: any
Parameters: Name Description
vec3Input vector with x, y, and z components representing a position in world space.
bearingBearing in degrees from north, used to determine the direction of the offset.
distanceDistance in meters to offset from the original position along the bearing direction.
Example: CMM.RelativePosition({x=100, y=50, z=10}, 45, 50)
Example Description: Returns a new position 50 meters at a 45-degree bearing from the original point, with y adjusted to match terrain height at that location.
Related Functions:
Notes: