User Tools

Site Tools


wiki:vector3

Vector3

Vector3 is a global meta-table composed of 3 numbers (Its data) and some functions to manipulate these data.

Data

  • x: number
  • y: number
  • z: number

Functions

Operators

  • __unm(Vector3)
  • __add(Vector3, Vector3)
  • __sub(Vector3, Vector3)
  • __mul(Vector3, number)
  • __div(Vector3, number)
  • __tostring(Vector3)

new()

  • Description: Create an instance of Vector3 with x, y and z equals to zero
  • Signature: (): Vector3

new(number, number, number)

  • Description: Create an instance of Vector3 with the given values
  • Signature: (x: number, y: number, z: number): Vector3

One()

  • Description: Returns a (1,1,1) Vector3
  • Signature: (): Vector3

Zero()

  • Description: Returns a (0,0,0) Vector3
  • Signature: (): Vector3

Forward()

  • Description: Returns a (0,0,1) Vector3
  • Signature: (): Vector3

Up()

  • Description: Returns a (0,1,0) Vector3
  • Signature: (): Vector3
  • Description: Returns a (1,0,0) Vector3
  • Signature: (): Vector3

Backward()

  • Description: Returns a (0,0,-1) Vector3
  • Signature: (): Vector3

Down()

  • Description: Returns a (0,-1,0) Vector3
  • Signature: (): Vector3

Left()

  • Description: Returns a (-1,0,0) Vector3
  • Signature: (): Vector3

Length(Vector3)

  • Description: Returns the length of the given Vector3
  • Signature: (target: Vector3): number

Distance(Vector3)

  • Description: Returns the distance between the given Vector3
  • Signature: (target: Vector3): number

Normalize(Vector3)

  • Description: Returns the normalized version of the given Vector3
  • Signature: (target: Vector3): number

Dot(Vector3, Vector3)

  • Description: Returns the dot product of the two given Vector3
  • Signature: (left: Vector3, right: Vector3): number

Cross(Vector3, Vector3)

  • Description: Returns the crossproduct of the two given Vector3
  • Signature: (left: Vector3, right: Vector3): Vector3

Lerp(Vector3, Vector3, number)

  • Description: Calculate the linear interpolation between two Vector3 using the given alpha
  • Signature: (start: Vector3, end: Vector3, alpha: number): Vector3

AngleBetween(Vector3, Vector3)

  • Description: Calculate the angle between two Vector3
  • Signature: (left: Vector3, right: Vector3): number
wiki/vector3.txt · Last modified: 2019/09/19 19:49 (external edit)