new Vector4([x], [y], [z], [w])
name | type | arguments | description |
---|---|---|---|
x | number | <optional> |
The x component. |
y | number | <optional> |
The y component. |
z | number | <optional> |
The z component. |
w | number | <optional> |
The w component. |
The w component of this Vector.
The x component of this Vector.
The y component of this Vector.
The z component of this Vector.
Add a given Vector to this Vector. Addition is component-wise.
name | type | description |
---|---|---|
v | Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4 |
The Vector to add to this Vector. |
This Vector4.
Make a clone of this Vector4.
A clone of this Vector4.
Copy the components of a given Vector into this Vector.
name | type | description |
---|---|---|
src | Phaser.Math.Vector4 |
The Vector to copy the components from. |
This Vector4.
Calculate the distance between this Vector and the given Vector.
name | type | description |
---|---|---|
v | Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4 |
The Vector to calculate the distance to. |
The distance from this Vector to the given Vector.
Calculate the distance between this Vector and the given Vector, squared.
name | type | description |
---|---|---|
v | Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4 |
The Vector to calculate the distance to. |
The distance from this Vector to the given Vector, squared.
Perform a component-wise division between this Vector and the given Vector.
Divides this Vector by the given Vector.
name | type | description |
---|---|---|
v | Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4 |
The Vector to divide this Vector by. |
This Vector4.
Calculate the dot product of this Vector and the given Vector.
name | type | description |
---|---|---|
v | Phaser.Math.Vector4 |
The Vector4 to dot product with this Vector4. |
The dot product of this Vector and the given Vector.
Check whether this Vector is equal to a given Vector.
Performs a strict quality check against each Vector's components.
name | type | description |
---|---|---|
v | Phaser.Math.Vector4 |
The vector to check equality with. |
A boolean indicating whether the two Vectors are equal or not.
Calculate the length (or magnitude) of this Vector.
The length of this Vector.
Calculate the length of this Vector squared.
The length of this Vector, squared.
Linearly interpolate between this Vector and the given Vector.
Interpolates this Vector towards the given Vector.
name | type | arguments | description |
---|---|---|---|
v | Phaser.Math.Vector4 |
The Vector4 to interpolate towards. |
|
t | number | <optional> |
The interpolation percentage, between 0 and 1. |
This Vector4.
Perform a component-wise multiplication between this Vector and the given Vector.
Multiplies this Vector by the given Vector.
name | type | description |
---|---|---|
v | Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4 |
The Vector to multiply this Vector by. |
This Vector4.
Negate the x
, y
, z
and w
components of this Vector.
This Vector4.
Normalize this Vector.
Makes the vector a unit length vector (magnitude of 1) in the same direction.
This Vector4.
Make this Vector the zero vector (0, 0, 0, 0).
This Vector4.
Scale this Vector by the given value.
name | type | description |
---|---|---|
scale | number |
The value to scale this Vector by. |
This Vector4.
Set the x
, y
, z
and w
components of the this Vector to the given x
, y
, z
and w
values.
name | type | description |
---|---|---|
x | number | object |
The x value to set for this Vector, or an object containing x, y, z and w components. |
y | number |
The y value to set for this Vector. |
z | number |
The z value to set for this Vector. |
w | number |
The z value to set for this Vector. |
This Vector4.
Subtract the given Vector from this Vector. Subtraction is component-wise.
name | type | description |
---|---|---|
v | Phaser.Math.Vector2 | Phaser.Math.Vector3 | Phaser.Math.Vector4 |
The Vector to subtract from this Vector. |
This Vector4.
Transform this Vector with the given Matrix.
name | type | description |
---|---|---|
mat | Phaser.Math.Matrix4 |
The Matrix4 to transform this Vector4 with. |
This Vector4.
Transform this Vector with the given Quaternion.
name | type | description |
---|---|---|
q | Phaser.Math.Quaternion |
The Quaternion to transform this Vector with. |
This Vector4.