Optionalx: number
The x component.
Optionaly: number
The y component.
Optionalz: number
The z component.
The x component of this Vector.
The y component of this Vector.
The z component of this Vector.
Static ReadonlyBACKA static back Vector3 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyDOWNA static down Vector3 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyFORWARDA static forward Vector3 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyLEFTA static left Vector3 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyONEA static one Vector3 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyRIGHTA static right Vector3 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyUPA static up Vector3 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Static ReadonlyZEROA static zero Vector3 for use by reference.
This constant is meant for comparison operations and should not be modified directly.
Add the given value to each component of this Vector.
The amount to add to this Vector.
This Vector3.
Make a clone of this Vector3.undefined
A new Vector3 object containing this Vector's values.
Calculate the dot product of this Vector and the given Vector.
The Vector3 to dot product with this Vector3.
The dot product of this Vector and v.
Check whether this Vector is equal to a given Vector.
Performs a strict equality check against each Vector's components.
The Vector3 to compare against.
True if the two vectors strictly match, otherwise false.
Sets the components of this Vector3 from the given array, based on the offset.
Vector3.x = array[offset] Vector3.y = array[offset + 1] Vector3.z = array[offset + 2]
The array of values to get this Vector from.
Optionaloffset: number
The offset index into the array. Default 0.
This Vector3.
Calculate the length (or magnitude) of this Vector.undefined
The length of this Vector.
Calculate the length of this Vector squared.undefined
The length of this Vector, squared.
Normalize this Vector.
Makes the vector a unit length vector (magnitude of 1) in the same direction.undefined
This Vector3.
Scale this Vector by the given value.
The value to scale this Vector by.
This Vector3.
Set the x, y, and z components of this Vector to the given x, y, and z values.
The x value to set for this Vector, or an object containing x, y and z components.
Optionaly: number
The y value to set for this Vector.
Optionalz: number
The z value to set for this Vector.
This Vector3.
Transform this Vector with the given Quaternion.
The Quaternion to transform this Vector with.
This Vector3.
Unproject this point from 2D space to 3D space. The point should have its x and y properties set to 2D screen space, and the z either at 0 (near plane) or 1 (far plane). The provided matrix is assumed to already be combined, i.e. projection * view * model.
After this operation, this vector's (x, y, z) components will represent the unprojected 3D coordinate.
This Vector3.
Set this Vector to point up.
Sets the y component of the vector to 1, and the others to 0.undefined
This Vector3.
A Vector3 is a mathematical object representing a point or direction in 3D space, defined by three components:
x,y, andz.Vector3 objects are used throughout Phaser's 3D math utilities, including matrix transformations, quaternion rotations, camera unprojection, and 3D-to-2D projection. They are commonly used when working with 3D renderers, custom shaders, or any code that needs to represent positions, directions, or normals in three-dimensional space.
The class includes methods for common vector operations such as addition, subtraction, scaling, normalization, dot and cross products, linear interpolation, and transformation by Matrix3, Matrix4, and Quaternion objects.
A set of static read-only constants (e.g.
Vector3.UP,Vector3.FORWARD) are provided for convenient directional references.