new Matrix4( [m])
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
m |
Phaser.Math.Matrix4 |
<optional> |
Optional Matrix4 to copy values from. |
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 15)
Members
-
val :Float32Array
-
The matrix values.
Type:
- Float32Array
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 35)
Methods
-
adjoint()
-
Calculate the adjoint, or adjugate, of this Matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 418)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
clone()
-
Make a clone of this Matrix4.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 56)
Returns:
A clone of this Matrix4.
- Type
- Phaser.Math.Matrix4
-
copy(src)
-
Copy the values of a given Matrix into this Matrix.
Parameters:
Name Type Description srcPhaser.Math.Matrix4 The Matrix to copy the values from.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 133)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
determinant()
-
Calculate the determinant of this Matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 470)
Returns:
The determinant of this Matrix.
- Type
- number
-
fromArray(a)
-
Set the values of this Matrix from the given array.
Parameters:
Name Type Description aArray.<number> The array to copy the values from. Must have at least 16 elements.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 150)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
fromQuat(q)
-
Set the values of this Matrix from the given Quaternion.
Parameters:
Name Type Description qPhaser.Math.Quaternion The Quaternion to set the values of this Matrix from.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1105)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
fromRotationTranslation(q, v)
-
Set the values of this Matrix from the given rotation Quaternion and translation Vector.
Parameters:
Name Type Description qPhaser.Math.Quaternion The Quaternion to set rotation from.
vPhaser.Math.Vector3 The Vector to set translation from.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1047)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
fromRotationXYTranslation(rotation, position, translateFirst)
-
Takes the rotation and position vectors and builds this Matrix4 from them.
Parameters:
Name Type Description rotationPhaser.Math.Vector3 The rotation vector.
positionPhaser.Math.Vector3 The position vector.
translateFirstboolean Should the operation translate then rotate (
true), or rotate then translate? (false)- Since: 3.50.0
- Source: src/math/Matrix4.js (Line 1670)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
frustum(left, right, bottom, top, near, far)
-
Generate a frustum matrix with the given bounds.
Parameters:
Name Type Description leftnumber The left bound of the frustum.
rightnumber The right bound of the frustum.
bottomnumber The bottom bound of the frustum.
topnumber The top bound of the frustum.
nearnumber The near bound of the frustum.
farnumber The far bound of the frustum.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1161)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
getInverse(m)
-
Copies the given Matrix4 into this Matrix and then inverses it.
Parameters:
Name Type Description mPhaser.Math.Matrix4 The Matrix4 to invert into this Matrix4.
- Since: 3.50.0
- Source: src/math/Matrix4.js (Line 324)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
getMaxScaleOnAxis()
-
Returns the maximum axis scale from this Matrix4.
- Since: 3.50.0
- Source: src/math/Matrix4.js (Line 1741)
Returns:
The maximum axis scale.
- Type
- number
-
identity()
-
Reset this Matrix to an identity (default) matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 276)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
invert()
-
Invert this Matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 341)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
lookAt(eye, center, up)
-
Generate a look-at matrix with the given eye position, focal point, and up axis.
Parameters:
Name Type Description eyePhaser.Math.Vector3 Position of the viewer
centerPhaser.Math.Vector3 Point the viewer is looking at
upPhaser.Math.Vector3 vec3 pointing up.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1393)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
lookAtRH(eye, target, up)
-
Generate a right-handed look-at matrix with the given eye position, target and up axis.
Parameters:
Name Type Description eyePhaser.Math.Vector3 Position of the viewer.
targetPhaser.Math.Vector3 Point the viewer is looking at.
upPhaser.Math.Vector3 vec3 pointing up.
- Since: 3.50.0
- Source: src/math/Matrix4.js (Line 1333)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
makeRotationAxis(axis, angle)
-
Derive a rotation matrix around the given axis.
Parameters:
Name Type Description axisPhaser.Math.Vector3 | Phaser.Math.Vector4 The rotation axis.
anglenumber The rotation angle in radians.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 814)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
multiply(src)
-
Multiply this Matrix by the given Matrix.
Parameters:
Name Type Description srcPhaser.Math.Matrix4 The Matrix to multiply this Matrix by.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 519)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
multiplyLocal(src)
-
Multiply the values of this Matrix4 by those given in the
srcargument.Parameters:
Name Type Description srcPhaser.Math.Matrix4 The source Matrix4 that this Matrix4 is multiplied by.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 599)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
multiplyMatrices(a, b)
-
Multiplies the two given Matrix4 objects and stores the results in this Matrix.
Parameters:
Name Type Description aPhaser.Math.Matrix4 The first Matrix4 to multiply.
bPhaser.Math.Matrix4 The second Matrix4 to multiply.
- Since: 3.50.0
- Source: src/math/Matrix4.js (Line 654)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
multiplyToMat4(src, out)
-
Multiplies this Matrix4 by the given
srcMatrix4 and stores the results in theoutMatrix4.Parameters:
Name Type Description srcPhaser.Math.Matrix4 The Matrix4 to multiply with this one.
outPhaser.Math.Matrix4 The receiving Matrix.
- Since: 3.50.0
- Source: src/math/Matrix4.js (Line 1597)
Returns:
This
outMatrix4.- Type
- Phaser.Math.Matrix4
-
ortho(left, right, bottom, top, near, far)
-
Generate an orthogonal projection matrix with the given bounds.
Parameters:
Name Type Description leftnumber The left bound of the frustum.
rightnumber The right bound of the frustum.
bottomnumber The bottom bound of the frustum.
topnumber The top bound of the frustum.
nearnumber The near bound of the frustum.
farnumber The far bound of the frustum.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1284)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
perspective(fovy, aspect, near, far)
-
Generate a perspective projection matrix with the given bounds.
Parameters:
Name Type Description fovynumber Vertical field of view in radians
aspectnumber Aspect ratio. Typically viewport width /height.
nearnumber Near bound of the frustum.
farnumber Far bound of the frustum.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1205)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
perspectiveLH(width, height, near, far)
-
Generate a perspective projection matrix with the given bounds.
Parameters:
Name Type Description widthnumber The width of the frustum.
heightnumber The height of the frustum.
nearnumber Near bound of the frustum.
farnumber Far bound of the frustum.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1246)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
premultiply(m)
-
Multiplies the given Matrix4 object with this Matrix.
This is the same as calling
multiplyMatrices(m, this).Parameters:
Name Type Description mPhaser.Math.Matrix4 The Matrix4 to multiply with this one.
- Since: 3.50.0
- Source: src/math/Matrix4.js (Line 637)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
rotate(rad, axis)
-
Apply a rotation transformation to this Matrix.
Parameters:
Name Type Description radnumber The angle in radians to rotate by.
axisPhaser.Math.Vector3 The axis to rotate upon.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 846)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
rotateX(rad)
-
Rotate this matrix on its X axis.
Parameters:
Name Type Description radnumber The angle in radians to rotate by.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 930)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
rotateY(rad)
-
Rotate this matrix on its Y axis.
Parameters:
Name Type Description radnumber The angle to rotate by, in radians.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 969)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
rotateZ(rad)
-
Rotate this matrix on its Z axis.
Parameters:
Name Type Description radnumber The angle to rotate by, in radians.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1008)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
scale(v)
-
Apply a scale transformation to this Matrix.
Uses the
x,yandzcomponents of the given Vector to scale the Matrix.Parameters:
Name Type Description vPhaser.Math.Vector3 | Phaser.Math.Vector4 The Vector to scale this Matrix with.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 763)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
scaleXYZ(x, y, z)
-
Apply a scale transformation to this Matrix.
Parameters:
Name Type Description xnumber The x component.
ynumber The y component.
znumber The z component.
- Since: 3.16.0
- Source: src/math/Matrix4.js (Line 780)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
scaling(x, y, z)
-
Set the scaling values of this Matrix.
Parameters:
Name Type Description xnumber The x scaling value.
ynumber The y scaling value.
znumber The z scaling value.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 250)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
set(src)
-
This method is an alias for
Matrix4.copy.Parameters:
Name Type Description srcPhaser.Math.Matrix4 The Matrix to set the values of this Matrix's from.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 69)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
setValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33)
-
Sets all values of this Matrix4.
Parameters:
Name Type Description m00number The m00 value.
m01number The m01 value.
m02number The m02 value.
m03number The m03 value.
m10number The m10 value.
m11number The m11 value.
m12number The m12 value.
m13number The m13 value.
m20number The m20 value.
m21number The m21 value.
m22number The m22 value.
m23number The m23 value.
m30number The m30 value.
m31number The m31 value.
m32number The m32 value.
m33number The m33 value.
- Since: 3.50.0
- Source: src/math/Matrix4.js (Line 84)
Returns:
This Matrix4 instance.
- Type
- Phaser.Math.Matrix4
-
setWorldMatrix(rotation, position, scale [, viewMatrix] [, projectionMatrix])
-
Generate a world matrix from the given rotation, position, scale, view matrix and projection matrix.
Parameters:
Name Type Argument Description rotationPhaser.Math.Vector3 The rotation of the world matrix.
positionPhaser.Math.Vector3 The position of the world matrix.
scalePhaser.Math.Vector3 The scale of the world matrix.
viewMatrixPhaser.Math.Matrix4 <optional>
The view matrix.
projectionMatrixPhaser.Math.Matrix4 <optional>
The projection matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1560)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
transform(position, scale, rotation)
-
Generates a transform matrix based on the given position, scale and rotation.
Parameters:
Name Type Description positionPhaser.Math.Vector3 The position vector.
scalePhaser.Math.Vector3 The scale vector.
rotationPhaser.Math.Quaternion The rotation quaternion.
- Since: 3.50.0
- Source: src/math/Matrix4.js (Line 180)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
translate(v)
-
Translate this Matrix using the given Vector.
Parameters:
Name Type Description vPhaser.Math.Vector3 | Phaser.Math.Vector4 The Vector to translate this Matrix with.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 724)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
translateXYZ(x, y, z)
-
Translate this Matrix using the given values.
Parameters:
Name Type Description xnumber The x component.
ynumber The y component.
znumber The z component.
- Since: 3.16.0
- Source: src/math/Matrix4.js (Line 739)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
transpose()
-
Transpose this Matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 289)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
xyz(x, y, z)
-
Set the
x,yandzvalues of this Matrix.Parameters:
Name Type Description xnumber The x value.
ynumber The y value.
znumber The z value.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 225)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
yawPitchRoll(yaw, pitch, roll)
-
Set the values of this matrix from the given
yaw,pitchandrollvalues.Parameters:
Name Type Description yawnumber The yaw value.
pitchnumber The pitch value.
rollnumber The roll value.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1499)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
zero()
-
Reset this Matrix.
Sets all values to
0.- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 165)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
