Vec3
The Vec3 class represents a vector in 3D space. Here is how you initialize one and get values from it.
let pos = new Vec3(2, 0, 0); log(pos); // output: {2, 0, 0} log(pos.x); // output: 2
Here’s more examples of its usage.
let a = new Vec3(1, 3, 5); let b = new Vec3(3, 7, 9); log(a); let sum = a.add(b); let length = a.length(); let sqrLength = a.sqrLength(); //squared length let normalized = a.normalize(); let diff = a.sub(b); let dotProduct = a.dot(b); let crossProduct = a.cross(b); let distanceBetweenPoints = a.distance(b); let factor = 2; let scaled = a.scale(factor); let alpha = 0.5; let lerp = a.lerp(b, alpha); let c = new Vec3(101, null, null); let cxe = c.isXEmpty(); //false let cye = c.isYEmpty(); //true let cze = c.isZEmpty(); //true