
A Vector object for 3d positions.
Kind: global class
Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3BooleanBooleanNumberVector3NumberNumberVector3Vector3NumberVector3Vector3Vector3Vector3Array.<Number>\*Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3Vector3NumberVector3Vector3Vector3Vector3Create the Vector object.
| Param | Type | Default | Description |
|---|---|---|---|
| x | number |
0 |
Vector X. |
| y | number |
0 |
Vector Y. |
| z | number |
0 |
Vector Z. |
Vector3Clone the vector.
Kind: instance method of Vector3
Returns: Vector3 - cloned vector.
Vector3Set vector value.
Kind: instance method of Vector3
Returns: Vector3 - this.
| Param | Type | Description |
|---|---|---|
| x | Number |
X component. |
| y | Number |
Y component. |
| z | Number |
Z component. |
Vector3Copy values from other vector into self.
Kind: instance method of Vector3
Returns: Vector3 - this.
Vector3Return a new vector of this + other.
Kind: instance method of Vector3
Returns: Vector3 - result vector.
| Param | Type | Description |
|---|---|---|
| Other | Number | Vector3 |
Vector3 or number to add to all components. |
Vector3Return a new vector of this - other.
Kind: instance method of Vector3
Returns: Vector3 - result vector.
| Param | Type | Description |
|---|---|---|
| Other | Number | Vector3 |
Vector3 or number to sub from all components. |
Vector3Return a new vector of this / other.
Kind: instance method of Vector3
Returns: Vector3 - result vector.
| Param | Type | Description |
|---|---|---|
| Other | Number | Vector3 |
Vector3 or number to divide by all components. |
Vector3Return a new vector of this * other.
Kind: instance method of Vector3
Returns: Vector3 - result vector.
| Param | Type | Description |
|---|---|---|
| Other | Number | Vector3 |
Vector3 or number to multiply with all components. |
Vector3Return a round copy of this vector.
Kind: instance method of Vector3
Returns: Vector3 - result vector.
Vector3Return a floored copy of this vector.
Kind: instance method of Vector3
Returns: Vector3 - result vector.
Vector3Return a ceiled copy of this vector.
Kind: instance method of Vector3
Returns: Vector3 - result vector.
Vector3Return a normalized copy of this vector.
Kind: instance method of Vector3
Returns: Vector3 - result vector.
Vector3Add other vector values to self.
Kind: instance method of Vector3
Returns: Vector3 - this.
| Param | Type | Description |
|---|---|---|
| Other | Number | Vector3 |
Vector or number to add. |
Vector3Sub other vector values from self.
Kind: instance method of Vector3
Returns: Vector3 - this.
| Param | Type | Description |
|---|---|---|
| Other | Number | Vector3 |
Vector or number to substract. |
Vector3Divide this vector by other vector values.
Kind: instance method of Vector3
Returns: Vector3 - this.
| Param | Type | Description |
|---|---|---|
| Other | Number | Vector3 |
Vector or number to divide by. |
Vector3Multiply this vector by other vector values.
Kind: instance method of Vector3
Returns: Vector3 - this.
| Param | Type | Description |
|---|---|---|
| Other | Number | Vector3 |
Vector or number to multiply by. |
Vector3Round self.
Kind: instance method of Vector3
Returns: Vector3 - this.
Vector3Floor self.
Kind: instance method of Vector3
Returns: Vector3 - this.
Vector3Ceil self.
Kind: instance method of Vector3
Returns: Vector3 - this.
Vector3Return a normalized copy of this vector.
Kind: instance method of Vector3
Returns: Vector3 - this.
BooleanReturn if vector equals another vector.
Kind: instance method of Vector3
Returns: Boolean - if vectors are equal.
| Param | Type | Description |
|---|---|---|
| other | Vector3 |
Other vector to compare to. |
BooleanReturn if vector approximately equals another vector.
Kind: instance method of Vector3
Returns: Boolean - if vectors are equal.
| Param | Type | Description |
|---|---|---|
| other | Vector3 |
Other vector to compare to. |
| threshold | Number |
Distance threshold to consider as equal. Defaults to 1. |
NumberReturn vector length (aka magnitude).
Kind: instance method of Vector3
Returns: Number - Vector length.
Vector3Return a copy of this vector multiplied by a factor.
Kind: instance method of Vector3
Returns: Vector3 - result vector.
NumberCalculate distance between this vector and another vector.
Kind: instance method of Vector3
Returns: Number - Distance between vectors.
| Param | Type | Description |
|---|---|---|
| other | Vector3 |
Other vector. |
NumberCalculate squared distance between this vector and another vector.
Kind: instance method of Vector3
Returns: Number - Distance between vectors.
| Param | Type | Description |
|---|---|---|
| other | Vector3 |
Other vector. |
Vector3Return a clone and clamp its values to be between min and max.
Kind: instance method of Vector3
Returns: Vector3 - Clamped vector.
| Param | Type | Description |
|---|---|---|
| min | Vector3 |
Min vector. |
| max | Vector3 |
Max vector. |
Vector3Clamp this vector values to be between min and max.
Kind: instance method of Vector3
Returns: Vector3 - Self.
| Param | Type | Description |
|---|---|---|
| min | Vector3 |
Min vector. |
| max | Vector3 |
Max vector. |
NumberCalculate the dot product with another vector.
Kind: instance method of Vector3
Returns: Number - Dot product value.
| Param | Type | Description |
|---|---|---|
| other | Vector3 |
Vector to calculate dot with. |
Vector3Set self values to be min values between self and a given vector.
Kind: instance method of Vector3
Returns: Vector3 - Self.
| Param | Type | Description |
|---|---|---|
| v | Vector3 |
Vector to min with. |
Vector3Set self values to be max values between self and a given vector.
Kind: instance method of Vector3
Returns: Vector3 - Self.
| Param | Type | Description |
|---|---|---|
| v | Vector3 |
Vector to max with. |
Vector3Create a clone vector that is the min result between self and a given vector.
Kind: instance method of Vector3
Returns: Vector3 - Result vector.
| Param | Type | Description |
|---|---|---|
| v | Vector3 |
Vector to min with. |
Vector3Create a clone vector that is the max result between self and a given vector.
Kind: instance method of Vector3
Returns: Vector3 - Result vector.
| Param | Type | Description |
|---|---|---|
| v | Vector3 |
Vector to max with. |
Convert to string.
Kind: instance method of Vector3
Array.<Number>Convert to array of numbers.
Kind: instance method of Vector3
Returns: Array.<Number> - Vector components as array.
\*Convert to dictionary.
Kind: instance method of Vector3
Returns: \* - Dictionary with {x,y,z}
| Param | Type | Description |
|---|---|---|
| minimized | Boolean |
If true, will not include keys that their values are 0. You can use fromDict on minimized dicts. |
Vector with 0,0,0 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 1,1,1 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 0.5,0.5,0.5 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with -1,0,0 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 1,0,0 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 0,-1,0 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 0,1,0 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 0,0,1 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector with 0,0,-1 values as a frozen shared object. Be careful not to try and change it.
Kind: static property of Vector3
Vector3Get vector with 0,0,0 values.
Kind: static method of Vector3
Returns: Vector3 - result vector.
Vector3Get vector with 1,1,1 values.
Kind: static method of Vector3
Returns: Vector3 - result vector.
Vector3Get vector with 0.5,0.5 values.
Kind: static method of Vector3
Returns: Vector3 - result vector.
Vector3Get vector with -1,0,0 values.
Kind: static method of Vector3
Returns: Vector3 - result vector.
Vector3Get vector with 1,0,0 values.
Kind: static method of Vector3
Returns: Vector3 - result vector.
Vector3Get vector with 0,-1,0 values.
Kind: static method of Vector3
Returns: Vector3 - result vector.
Vector3Get vector with 0,1,0 values.
Kind: static method of Vector3
Returns: Vector3 - result vector.
Vector3Get vector with 0,0,1 values.
Kind: static method of Vector3
Returns: Vector3 - result vector.
Vector3Get vector with 0,0,-1 values.
Kind: static method of Vector3
Returns: Vector3 - result vector.
Vector3Lerp between two vectors.
Kind: static method of Vector3
Returns: Vector3 - result vector.
| Param | Type | Description |
|---|---|---|
| p1 | Vector3 |
First vector. |
| p2 | Vector3 |
Second vector. |
| a | Number |
Lerp factor (0.0 - 1.0). |
NumberCalculate distance between two vectors.
Kind: static method of Vector3
Returns: Number - Distance between vectors.
| Param | Type | Description |
|---|---|---|
| p1 | Vector3 |
First vector. |
| p2 | Vector3 |
Second vector. |
Vector3Return cross product between two vectors.
Kind: static method of Vector3
Returns: Vector3 - Crossed vector.
| Param | Type | Description |
|---|---|---|
| p1 | Vector3 |
First vector. |
| p2 | Vector3 |
Second vector. |
Vector3Parse and return a vector object from string in the form of “x,y”.
Kind: static method of Vector3
Returns: Vector3 - Parsed vector.
| Param | Type | Description |
|---|---|---|
| str | String |
String to parse. |
Vector3Create vector from array of numbers.
Kind: static method of Vector3
Returns: Vector3 - Vector instance.
| Param | Type | Description |
|---|---|---|
| arr | Array.<Number> |
Array of numbers to create vector from. |
Vector3Create vector from a dictionary.
Kind: static method of Vector3
Returns: Vector3 - Newly created vector.
| Param | Type | Description |
|---|---|---|
| data | \* |
Dictionary with {x,y,z}. |