The 3D Web browser Core API contains various 3D types for representing 3D positions, vectors, orientations, transforms and geometric shapes.
These types are located in the Core.Math and Core.Math.Geom namespaces.
For example, the 'Vector3' type represents a vector in 3D space.
A new Vector3 can be created using code like:
local v = Core.Math.Vector3.New(x, y, z)
There are aliases for all the Math and Math.Geom New functions in the global namespace, so the above code can also be written:
local v = Vector3(x, y, z)
This simplifies use of these types considerably.
The x, y, z values passed in to the New function specify the three coordinate values.
See the full documentation for a list of all the kinds of parameters that the New function can take.
Leave them out to get a zero vector.
Once a Math value has been created, it can be used in normal ways:
local v1 = Vector3()
local v2 = Vector3(1, 2, 3)
assert(v2 > v1)
local r = v1 + v2
assert(r:GetX() == 1)
assert(Core.Math.Dot(r, v2) == 14)
And so on.
There are some standard Vector3 values defined in the Core API:
Core.xAxis = Vector3(1, 0, 0)
Core.yAxis = Vector3(0, 1, 0)
Core.zAxis = Vector3(0, 0, 1)