Skip to content
Yash Giri edited this page Nov 28, 2022 · 2 revisions

The Vector Library

This library is very useful when it comes to position tracking. A Vector is simply 3 values:

  • x
  • y
  • z

These values come with many effects and they allow you to do lots of things.

The Vector Object

It contains math operations

  • add

Adds a vector to the selected vector

  • subtract

Subtracts a vector with the selected vector

  • scalar

Multiplies a number to all the components of the vector

  • dot

Returns the dot product of 2 vectors

  • cross

Returns the cross product of 2 vectors

It contains some complex operations

  • normalize

Sets the vector components to their unit equivalents

  • setMag

Sets the magnitude without changing the direction

  • dist

Finds the distance between 2 vectors

  • rotate

Rotates a vector by the given value along the z axis

  • getNegative

Returns a negated clone of the vector

It contains some generators

  • rand

Generates a positive vector withing a given value

  • randSigned

Generates a random vector within a given value (Both positive and negative)

  • VecFromAdd

Returns the addition of 2 vectors

  • VecFromSub

Returns the subtraction of 2 vectors

  • getNormailzed

Returns a normalized version of the given vector

  • getAverage

Returns the average of an array of vectors

  • clone

Returns a clone of the vector