Hey everyone, we got another great update for you today! We have added 2 very long requested features a Music Player and PDF support!
There are also a ton of great additions and improvements listed below in the patch notes.
Constructors:
Vector(num, num, num) --> return a vector with specified (x, y, z) components
Vector(table) --> return a vector with x/y/z or 1/2/3 conponents from source table (x/y/z first)
Vector.new(...) --> same as Vector(...)
Vector.max(vec1, vec2) --> return a vector with max components between vec1 and vec2
Vector.min(vec1, vec2) --> return a vector with min components between vec1 and vec2
Vector.between(vec1, vec2) --> return a vector pointing from vec1 to vec2
vec:copy() --> copy self into a new vector and retur it
Component access:
vec.x, vec.y, vec.z --> read/write component
v[1], v[2], v[3] --> read/write component
vec:get() => num, num, num --> returns x, y, z components of self
Methods modifying self and returning self:
vec:setAt(key, num) --> same as "vec[key] = num"
vec:set(num, num, num) --> set x, y, z components to passed values
vec:add(otherVec) --> adds components of otherVec to self
vec:sub(otherVec) --> subtracts components of otherVec from self
vec:scale(otherVec) --> multiplies self components by corresponding compnents from otherVec
vec:scale(num) --> multiplies self components by a numeric factor
vec:clamp(num) --> if self magnitude is higher than provided limit, scale self down to match it
vec:normalize() --> scale self to magnitude of 1
vec:project(otherVec) --> make self into projection on another vector
vec:reflect(otherVec) --> reflect self over a plane defined through a normal vector arg
vec:inverse() --> multiply self components by -1
vec:moveTowards(otherVec, num) --> move self towards another vector, but only up to a provided distance limit
vec:rotateTowards(otherVec, num) --> rotate self towards another vector, but only up to a provided angle limit
vec:projectOnPlane(otherVec) --> project self on a plane defined through a normal vector arg
Methods not modifying self:
vec:dot(otherVec) --> return a dot product of self with otherVec
vec:magnitude() --> return self magnitude (length)
vec:sqrMagnitude() --> return self magnitude (length) squared
vec:distance(otherVec) --> returns distance between self and otherVec
vec:sqrDistance(otherVec) --> returns squared distance between self and otherVec
vec:equals(otherVec, num) --> returns true if otherVec same as self (optional numeric tolerance param), false otherwise
vec:string(str) --> return string describing self, optional string prefix
vec:angle(otherVec) --> return an angle between self and otherVec, in degrees [0, 180]
vec:cross(otherVec) --> return a cross-product vector of self and otherVec
vec:lerp(otherVec, num) --> return a vector some part of the way between self and otherVec, numeric arg [0, 1] is the fraction
vec:normalized() --> return a new vector that is normalized (length 1) version of self
vec:orthoNormalize() --> return three normalized vectors perpendicular to each other, first one being in the same dir as self
vec:orthoNormalize(otherVec) --> same as vec:orthoNormalize(), but second vector is guranteed to be on a self-otherVec plane
Operators:
vecOne + vecTwo --> return a new vector with added components of vecOne and vecTwo
vecOne - vecTwo --> return a new vector with subtracted components of vecTwo from vecOne
vecOne * vecTwo --> return a new vector with multiplied components of vecOne and vecTwo, NOT a dot product (!)
vec * number --> return a new vector with all components from vec scaled by a numeric factor
number * vec --> same as "vec * number"
vecOne == vecTwo --> return true if both vectors identical or within a small margin of each other, false otherwise
tostring(vec) --> return a string description of a vector
Constructors:
Color(num, num, num) --> return a color with specified (r, g, b) components
Color(num, num, num, num) --> return a color with specified (r, g, b, a) components
Color(table) --> return a color with r/g/b/a or 1/2/3/4 components from source table (letter keys prioritized)
Color.new(...) --> same as Color(...)
Color.fromString(colorStr) --> return a color from a color string ('Red', 'Green' etc), capitalization ignored
Color.fromHex(hexStr) --> return a color from a hex representation string (e.g. '#ff112233'), hash sign and alpha are optional
col:copy() --> copy self into a new color and return it
Color.Purple [etc] --> shorthand for Color.fromString('Purple'), works for all player and added colors, capitalization ignored
Component access:
col.r, col.g, col.b, col.a --> read/write component
col[1], col[2], col[3], col[4] --> read/write component
col:get() => num, num, num, num --> returns r, g, b, a components of self
col:toHex(includeAlpha) --> returns a hex string for self, boolean parameter
col:toString(num) --> returns a color string if matching this instance, nil otherwise, optional numeric tolerance param
Methods modifying self and returning self:
col:setAt(key, num) --> same as "col[key] = num"
col:set(num, num, num, num) --> set r, g, b, a components to passed values
Methods not modifying self:
col:equals(otherCol, num) --> returns true if otherCol same as self, false otherwise, optional numeric tolerance param
col:lerp(otherCol, num) --> return a color some part of the way between self and otherCol, numeric arg [0, 1] is the fraction
Operators:
colOne == colTwo --> return true if both colors identical or within a small margin of each other, false otherwise
tostring(col) --> return a string description of a color
Other:
Color.list --> table of all color strings
Color.Add(name, yourColor) --> add your own color definition to the class (string name, Color instance yourColor)