Vector3 Class

Module: Math

Class representing a 3D vector. A 3D vector is an ordered triplet of numbers (labeled x, y, and z), which can be used to represent a number of things, such as:

  • A point in 3D space.
  • A direction and length in 3D space. In three.js the length will always be the Euclidean distance (straight-line distance) from (0, 0, 0) to (x, y, z) and the direction is also measured from (0, 0, 0) towards (x, y, z).
  • Any arbitrary ordered triplet of numbers.

There are other things a 3D vector can be used to represent, such as momentum vectors and so on, however these are the most common uses in three.js.

Original documentation for Vector3 can be found here https://threejs.org/docs/index.html#Reference/Math/Vector3

Constructor

Vector3

()

Item Index

Methods

Properties

Methods

add

(
  • v
)

Add v to this vector.

Parameters:

addScalar

(
  • scalar
)

Add the scalar value s to this vector's x, y and z values.

Parameters:

  • scalar Number

Properties

x

Number

Default: 0

y

Number

Default: 0

z

Number

Default: 0