Skip to content

Vector3

Vector3 is a 3D vector with an x, y and z component.

Properties

  • X: number
  • Y: number
  • Z: number
  • Forward: Vector3
  • Back: Vector3
  • Down: Vector3
  • Left: Vector3
  • One: Vector3
  • Zero: Vector3
  • Right: Vector3
  • Up: Vector3
  • Magnitude: number
  • Normalized: Vector3
  • SqrMagnitude: number

Methods

New() → Vector3

Returns a new Vector3 with the given Vector2 components and a z component of 0.

New(d: number) → Vector3

Returns a new Vector3 with the given Vector2 components and a z component of 0.

New(x: number, y: number) → Vector3

Returns a new Vector3 with the given Vector2 components and a z component of 0.

New(x: number, y: number, z: number) → Vector3

Returns a new Vector3 with the given Vector2 components and a z component of 0.

New(v: Vector2) → Vector3

Returns a new Vector3 with the given Vector2 components and a z component of 0.

Angle(from: Vector3, to: Vector3) → number

Returns the angle in degrees between from and to.

Cross(lhs: Vector3, rhs: Vector3) → Vector3

Returns the cross product of lhs and rhs.

Distance(a: Vector3, b: Vector3) → number

Returns the distance between a and b.

Dot(lhs: Vector3, rhs: Vector3) → number

Returns the dot product of lhs and rhs.

Lerp(a: Vector3, b: Vector3, t: number) → Vector3

Returns a new Vector3 that is the linear interpolation between a and b by t.

Max(lhs: Vector3, rhs: Vector3) → Vector3

Returns a vector that is made from the largest components of two vectors.

Min(lhs: Vector3, rhs: Vector3) → Vector3

Returns a vector that is made from the smallest components of two vectors.

MoveTowards(current: Vector3, target: Vector3, maxDistanceDelta: number) → Vector3

Calculate a position between the points specified by current and target, moving no farther than the distance specified by maxDistanceDelta.

Normalize(value: Vector3) → Vector3

Returns a new Vector3 that is the normalized version of the given vector.

Project(vector: Vector3, onNormal: Vector3) → Vector3

Returns the projection of a vector onto another vector.

Reflect(inDirection: Vector3, inNormal: Vector3) → Vector3

Returns the reflection of a vector off the plane defined by a normal.

SignedAngle(from: Vector3, to: Vector3, axis: Vector3) → number

Returns the signed angle in degrees between from and to.

Slerp(a: Vector3, b: Vector3, t: number) → Vector3

Spherically interpolates between two vectors.