Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Vector3

Hierarchy

  • Vector3

Index

Constructors

constructor

  • Parameters

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

    Returns Vector3

  • Parameters

    • arr: [number, number, number]

    Returns Vector3

  • Parameters

    Returns Vector3

  • Parameters

    • value: number

    Returns Vector3

Properties

Readonly x

x: number

Readonly y

y: number

Readonly z

z: number

Static Readonly back

back: Vector3

(0, -1, 0) vector

Static Readonly down

down: Vector3

(0, 0, -1) vector

Static Readonly forward

forward: Vector3

(0, 1, 0) vector

Static Readonly left

left: Vector3

(-1, 0, 0) vector

Static Readonly negativeInfinity

negativeInfinity: Vector3

(-Infinity, -Infinity, -Infinity) vector

Static Readonly one

one: Vector3

(1, 1, 1) vector

Static Readonly positiveInfinity

positiveInfinity: Vector3

(Infinity, Infinity, Infinity) vector

Static Readonly right

right: Vector3

(1, 0, 0) vector

Static Readonly up

(0, 0, 1) vector

Static Readonly zero

zero: Vector3

(0, 0, 0) vector

Accessors

length

  • get length(): number
  • Returns number

Methods

add

  • Adds two vectors.

    Parameters

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

    Returns Vector3

  • Adds a number to all vector axis.

    Parameters

    • value: number

    Returns Vector3

  • Adds two vectors.

    Parameters

    • array: [number, number, number]

    Returns Vector3

  • Adds two vectors.

    Parameters

    Returns Vector3

angleTo

  • Calculates angle between to vectors (in radians).

    Parameters

    Returns number

angleToDegrees

  • angleToDegrees(vector: IVector3): number
  • Calculates angle between to vectors (in degrees).

    Parameters

    Returns number

cross

  • Calculates cross product between two vectors.

    Parameters

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

    Returns Vector3

  • Calculates cross product between vector and a number.

    Parameters

    • value: number

    Returns Vector3

  • Calculates cross product between two vectors.

    Parameters

    • array: [number, number, number]

    Returns Vector3

  • Calculates cross product between two vectors.

    Parameters

    Returns Vector3

distanceTo

  • Calculates distance between vectors.

    Parameters

    Returns number

distanceToSquared

  • distanceToSquared(vector: IVector3): number
  • Calculates squared distance between vectors.

    Parameters

    Returns number

div

  • Divides two vectors.

    Parameters

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

    Returns Vector3

  • Divides all vector axis by value.

    Parameters

    • value: number

    Returns Vector3

  • Divides two vectors.

    Parameters

    • array: [number, number, number]

    Returns Vector3

  • Divides two vectors.

    Parameters

    Returns Vector3

dot

  • dot(x: number, y: number, z: number): number
  • dot(value: number): number
  • dot(array: [number, number, number]): number
  • dot(vector: IVector3): number
  • Calculates dot product between two vectors.

    Parameters

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

    Returns number

  • Calculates dot product between vector and a number.

    Parameters

    • value: number

    Returns number

  • Calculates dot product between two vectors.

    Parameters

    • array: [number, number, number]

    Returns number

  • Calculates dot product between two vectors.

    Parameters

    Returns number

inverse

  • Returns Vector3

isInRange

  • isInRange(vector: IVector3, range: number): boolean
  • Checks if distance between vectors is smaller or equal to range.

    Parameters

    Returns boolean

lerp

  • Interpolates vectors linearly.

    Parameters

    Returns Vector3

mul

  • Multiplies two vectors.

    Parameters

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

    Returns Vector3

  • Multiplies all vector axis by a number.

    Parameters

    • value: number

    Returns Vector3

  • Multiplies two vectors.

    Parameters

    • array: [number, number, number]

    Returns Vector3

  • Multiplies two vectors.

    Parameters

    Returns Vector3

negative

  • Negates vector.

    Returns Vector3

normalize

  • Normalizes vector.

    Returns Vector3

sub

  • Subtracts two vectors.

    Parameters

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

    Returns Vector3

  • Subtracts a number from all vector axis.

    Parameters

    • value: number

    Returns Vector3

  • Subtracts two vectors.

    Parameters

    • array: [number, number, number]

    Returns Vector3

  • Subtracts two vectors.

    Parameters

    Returns Vector3

toArray

  • toArray(): [number, number, number]
  • Returns [x, y, z] array.

    Returns [number, number, number]

toDegrees

  • Converts radians to degrees.

    Returns Vector3

toFixed

  • toFixed(precision: number): Vector3
  • Parameters

    • precision: number

    Returns Vector3

toRadians

  • Converts degrees to radians.

    Returns Vector3

toString

  • toString(): string
  • Returns string