Builtin Library
README.md
math.vec4 (procNode)
A vector of four components from its parts: numbers, or vectors and runs whose components fill it in order. A part left out reads 0, so vec4(x) is (x, 0, 0, 0).
The vec4 operation of the authoring surface, called through the Luau node on proc.fieldc.operators. Operands are numbers, vectors, Columns or Fields. When every operand is a plain number or vector the answer is the plain result, folded where the node cooks; otherwise the answer is a Field: a template over its operands that whatever reads it evaluates in one dispatch together with the chain around it. Nothing dispatches for this node alone. Over numbers and animated values the answer is an animated value: the operation at every time.
Parts are read in order and each fills as many components as it holds, so vec4(vec2(1, 2), vec2(3, 4)) is (1, 2, 3, 4). Parts holding more components than the vector are an error. In a graph source, vector.create(...) with at least one socket among its components records this node: two components math.vec2, three math.vec3, four or more math.vec4. With plain numbers only it is Luau's own vector.create, which holds three components: vector.create(1, 2) is (1, 2, 0) and vector.create(1, 2, 3, 4) is (1, 2, 3); write g.math.vec2(...) or g.math.vec4(...) for a plain two- or four-component vector.
Inputs
x(Value, default 0). The first part: the x component, or a vector whose components lead.y(Value, optional). The second part.z(Value, optional). The third part.w(Value, optional). The fourth part.
Outputs
value. A Vec4.
local value = g.math.vec4(g.math.vec2(1, 2), g.math.vec2(3, 4)) -- (1, 2, 3, 4)