Skip to content

Vec3

Properties

  • x (number): X component
  • y (number): Y component
  • z (number): Z component

Functions

  • Clamp(): Shorten this vector in place to at most the given length
  • Cross(): Vec3.Cross(a, b): cross product
  • Distance(): Vec3.Distance(a, b): distance between two points
  • Dot(): Vec3.Dot(a, b): dot product
  • Length(): Get the vector's length
  • Lerp(): Vec3.Lerp(a, b, alpha): blend from a to b
  • Normalize(): Scale this vector to length 1, in place
  • Reflect(): Vec3.Reflect(v, normal): bounce a vector off a surface
  • SqrLength(): Get the squared length, cheaper than Length for comparisons
  • Zero(): Set this vector to 0, 0, 0 in place
  • new(): Vec3.new(x, y, z), or Vec3.new() for 0, 0, 0. Supports +, - and * by a number