A four-component vector.
     | Constructor Name | Return Type | Description | Tags | 
    | Vector4.New([number x, number y, number z, number w]) | Vector4 | Constructs a Vector4 with the given x,y,z,wvalues, defaults to (0, 0, 0, 0). | None | 
  | Vector4.New(number v) | Vector4 | Constructs a Vector4 with x,y,z,wvalues all set to the given value. | None | 
  | Vector4.New(Vector3 xyz, number w) | Vector4 | Constructs a Vector4 with x,y,zvalues from the given Vector3 and the givenwvalue. | None | 
  | Vector4.New(Vector4 v) | Vector4 | Constructs a Vector4 with x,y,z,wvalues from the given Vector4. | None | 
  | Vector4.New(Vector2 xy, Vector2 zw) | Vector4 | Constructs a Vector4 with x,yvalues from the first Vector2 andz,wvalues from the second Vector2. | None | 
  | Vector4.New(Color v) | Vector4 | Constructs a Vector4 with x,y,z,wvalues mapped from the given Color'sr,g,b,avalues. | None | 
  
     | Constant Name | Return Type | Description | Tags | 
    | Vector4.ZERO | Vector4 | (0, 0, 0, 0) | None | 
  | Vector4.ONE | Vector4 | (1, 1, 1, 1) | None | 
  
     | Property Name | Return Type | Description | Tags | 
    | x | number | The xcomponent of the Vector4. | Read-Write | 
  | y | number | The ycomponent of the Vector4. | Read-Write | 
  | z | number | The zcomponent of the Vector4. | Read-Write | 
  | w | number | The wcomponent of the Vector4. | Read-Write | 
  | size | number | The magnitude of the Vector4. | Read-Only | 
  | sizeSquared | number | The squared magnitude of the Vector4. | Read-Only | 
  
     | Function Name | Return Type | Description | Tags | 
    | GetNormalized() | Vector4 | Returns a new Vector4 with size 1, but still pointing in the same direction. Returns (0, 0, 0, 0) if the vector is too small to be normalized. | None | 
  | GetAbs() | Vector4 | Returns a new Vector4 with each component the absolute value of the component from this Vector4. | None | 
  
     | Class Function Name | Return Type | Description | Tags | 
    | Vector4.Lerp(Vector4 from, Vector4 to, number progress) | Vector4 | Linearly interpolates between two vectors by the specified progress amount and returns the resultant Vector4. | None | 
  
     | Operator Name | Return Type | Description | Tags | 
    | Vector4 + Vector4 | Vector4 | Component-wise addition. | None | 
  | Vector4 + number | Vector4 | Adds the right-side number to each of the components in the left side and returns the resulting Vector4. | None | 
  | Vector4 - Vector4 | Vector4 | Component-wise subtraction. | None | 
  | Vector4 - number | Vector4 | Subtracts the right-side number from each of the components in the left side and returns the resulting Vector4. | None | 
  | Vector4 * Vector4 | Vector4 | Component-wise multiplication. | None | 
  | Vector4 * number | Vector4 | Multiplies each component of the Vector4 by the right-side number. | None | 
  | number * Vector4 | Vector4 | Multiplies each component of the Vector4 by the left-side number. | None | 
  | Vector4 / Vector4 | Vector4 | Component-wise division. | None | 
  | Vector4 / number | Vector4 | Divides each component of the Vector4 by the right-side number. | None | 
  | -Vector4 | Vector4 | Returns the negation of the Vector4. | None | 
  | Vector4 .. Vector4 | number | Returns the dot product of the Vector4s. | None | 
  | Vector4 ^ Vector4 | Vector4 | Returns the cross product of the Vector4s. | None | 
  
  Example using:
       This example shows how a Color can be converted into a Vector4, which opens the possibility of some math operations that are available to the latter.
 function ColorToVector4(color)
    local v = Vector4.New()
    v.x = color.r
    v.y = color.g
    v.z = color.b
    v.w = color.a
    return v
end
function GetMagnitudeOfColor(color)
    local v = ColorToVector4(color)
    return v.size
end
See also: Color.r
 
  
   Last update: January 13, 2022