A vector composed of components (X, Y, Z) with floating point precision.
This structure is Open Sourced at https://github.com/nanos-world/nanos-world-lua-lib. Feel free to push merge requests and suggest changes!
Vectors are internally and automatically compressed, which reduces it's size in the network up to 90%. Some cool details:
- Vectors parameters in Classes Methods are usually compressed with precision of 1 decimal place (with some exceptions which we need more precision).
- Vectors passed in Remote Events are compressed with precision of 2 decimal places. If you need more precision, we recommend passing them as raw number instead.
local new_vector = Vector(1452.5, 512, 943.1)
Note: This structure supports
|boolean||Check against another vector for equality, within specified error limits|
|number||Distance between two points|
|number||Squared distance between two points|
|Vector||Calculates normalized version of vector without checking for zero length|
|Vector||Gets a normalized copy of the vector, checking it is safe to do so based on the length|
|boolean||Checks whether vector is near to zero within a specified tolerance|
|boolean||Checks whether all components of the vector are exactly zero|
|boolean||Normalize this vector in-place if it is larger than a given tolerance. Leaves it unchanged if not|
|number||Get the length (magnitude) of this vector|
|number||Get the squared length of this vector|
|Rotator||Returns the orientation corresponding to the direction in which the vector points|