Perform operations with vectors easier
Why vectors, not Number2/Number3?
Its your decision, use vectors or not, but they have some cool features
Features:
- Compability with Number2/3`s
- Easy to add in project: just copy paste the code
- New functions: Floor(), Ceil(), Round()
- Ability to multiply/divide vector by vector (Number2/3`s can't do this):
a = vector3(10, 10, 10)
b = vector3(2, 1, 0)
c = a * b -- vector3(20, 10, 0)
- Ability to get vector length using
#symbol:
vec = vector2(10, 10)
print(#vec)
- You can use lowercase letters if you want:
vec.X = 10 vec.y = 20
print(vec.x, vec.Y)
- Easy to transform to Number2, Number3, Color
vec3d:toNumber3()
vec3d:toColor()
vec2d:toNumber2()
Examples:
vec = vector3( Number3(10, 10, 10) ) -- creating vector from Number3
vec2 = vector3( 10, 10, 10 )
print(vec/vec2) -- vector3(1, 1, 1)