Jump to content

FastConvertVec2ToVec3

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: FastConvertVec2ToVec3
Function Description: Converts a 2D vector table into a 3D vector table by extending it with a zero y value and preserving z if present, or assigning z from y when x is available.
File Location: cmm.positionFunctions.lua
Syntax: CMM.FastConvertVec2ToVec3( 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.FastConvertVec2ToVec3({x = 10, y = 20})
Example Description: Converts a 2D vector with x and y values into a 3D vector by setting y to zero and returning {x = 10, y = 0, z = 20}.
Related Functions:
Notes: