Jump to content

ConvertVec2ToVec3

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: ConvertVec2ToVec3
Function Description: Converts a 2D vector table into a 3D vector table by extending it with a height value derived from the terrain if z is missing and x is present, otherwise returns the input directly.
File Location: cmm.positionFunctions.lua
Syntax: CMM.ConvertVec2ToVec3( table vec2 )
Return Value: table
Parameters: Name Description
vec2Table representing a vec2 with x and y values, may optionally have a z value; if z is present, returns the input directly.
Example: CMM.ConvertVec2ToVec3({x = 10, y = 20})
Example Description: Converts a 2D vector with x and y values into a 3D vector by retrieving terrain height at the x,y position and returning {x = 10, y = height, z = 20}.
Related Functions:
Notes: