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 14)
Members
-
val :Float32Array
-
The matrix values.
Type:
- Float32Array
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 31)
Methods
-
adjoint()
-
Calculate the adjoint, or adjugate, of this Matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 380)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
clone()
-
Make a clone of this Matrix4.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 52)
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 src
Phaser.Math.Matrix4 The Matrix to copy the values from.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 82)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
determinant()
-
Calculate the determinant of this Matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 432)
Returns:
The determinant of this Matrix.
- Type
- number
-
fromArray(a)
-
Set the values of this Matrix from the given array.
Parameters:
Name Type Description a
array The array to copy the values from.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 117)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
fromQuat(q)
-
Set the values of this Matrix from the given Quaternion.
Parameters:
Name Type Description q
Phaser.Math.Quaternion The Quaternion to set the values of this Matrix from.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1009)
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 q
Phaser.Math.Quaternion The Quaternion to set rotation from.
v
Phaser.Math.Vector3 The Vector to set translation from.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 949)
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 left
number The left bound of the frustum.
right
number The right bound of the frustum.
bottom
number The bottom bound of the frustum.
top
number The top bound of the frustum.
near
number The near bound of the frustum.
far
number The far bound of the frustum.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1067)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
identity()
-
Reset this Matrix to an identity (default) matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 236)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
invert()
-
Invert this Matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 303)
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 eye
Phaser.Math.Vector3 Position of the viewer
center
Phaser.Math.Vector3 Point the viewer is looking at
up
Phaser.Math.Vector3 vec3 pointing up.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1245)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
makeRotationAxis(axis, angle)
-
Derive a rotation matrix around the given axis.
Parameters:
Name Type Description axis
Phaser.Math.Vector3 | Phaser.Math.Vector4 The rotation axis.
angle
number The rotation angle in radians.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 720)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
multiply(src)
-
Multiply this Matrix by the given Matrix.
Parameters:
Name Type Description src
Phaser.Math.Matrix4 The Matrix to multiply this Matrix by.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 481)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
multiplyLocal(src)
-
Multiply the values of this Matrix4 by those given in the
src
argument.Parameters:
Name Type Description src
Phaser.Math.Matrix4 The source Matrix4 that this Matrix4 is multiplied by.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 561)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
ortho(left, right, bottom, top, near, far)
-
Generate an orthogonal projection matrix with the given bounds.
Parameters:
Name Type Description left
number The left bound of the frustum.
right
number The right bound of the frustum.
bottom
number The bottom bound of the frustum.
top
number The top bound of the frustum.
near
number The near bound of the frustum.
far
number The far bound of the frustum.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1195)
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 fovy
number Vertical field of view in radians
aspect
number Aspect ratio. Typically viewport width /height.
near
number Near bound of the frustum.
far
number Far bound of the frustum.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1113)
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 width
number The width of the frustum.
height
number The height of the frustum.
near
number Near bound of the frustum.
far
number Far bound of the frustum.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1155)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
rotate(rad, axis)
-
Apply a rotation transformation to this Matrix.
Parameters:
Name Type Description rad
number The angle in radians to rotate by.
axis
Phaser.Math.Vector3 The axis to rotate upon.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 754)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
rotateX(rad)
-
Rotate this matrix on its X axis.
Parameters:
Name Type Description rad
number The angle in radians to rotate by.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 832)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
rotateY(rad)
-
Rotate this matrix on its Y axis.
Parameters:
Name Type Description rad
number The angle to rotate by, in radians.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 871)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
rotateZ(rad)
-
Rotate this matrix on its Z axis.
Parameters:
Name Type Description rad
number The angle to rotate by, in radians.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 910)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
scale(v)
-
Apply a scale transformation to this Matrix.
Uses the
x
,y
andz
components of the given Vector to scale the Matrix.Parameters:
Name Type Description v
Phaser.Math.Vector3 | Phaser.Math.Vector4 The Vector to scale this Matrix with.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 649)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
scaleXYZ(x, y, z)
-
Apply a scale transformation to this Matrix.
Parameters:
Name Type Description x
number The x component.
y
number The y component.
z
number The z component.
- Since: 3.16.0
- Source: src/math/Matrix4.js (Line 686)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
scaling(x, y, z)
-
Set the scaling values of this Matrix.
Parameters:
Name Type Description x
number The x scaling value.
y
number The y scaling value.
z
number The z scaling value.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 210)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
set(src)
-
This method is an alias for
Matrix4.copy
.Parameters:
Name Type Description src
Phaser.Math.Matrix4 The Matrix to set the values of this Matrix's from.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 67)
Returns:
This Matrix4.
- 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 rotation
Phaser.Math.Vector3 The rotation of the world matrix.
position
Phaser.Math.Vector3 The position of the world matrix.
scale
Phaser.Math.Vector3 The scale of the world matrix.
viewMatrix
Phaser.Math.Matrix4 <optional>
The view matrix.
projectionMatrix
Phaser.Math.Matrix4 <optional>
The projection matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1414)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
translate(v)
-
Translate this Matrix using the given Vector.
Parameters:
Name Type Description v
Phaser.Math.Vector3 | Phaser.Math.Vector4 The Vector to translate this Matrix with.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 600)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
translateXYZ(x, y, z)
-
Translate this Matrix using the given values.
Parameters:
Name Type Description x
number The x component.
y
number The y component.
z
number The z component.
- Since: 3.16.0
- Source: src/math/Matrix4.js (Line 625)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
transpose()
-
Transpose this Matrix.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 268)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
xyz(x, y, z)
-
Set the
x
,y
andz
values of this Matrix.Parameters:
Name Type Description x
number The x value.
y
number The y value.
z
number The z value.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 185)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4
-
yawPitchRoll(yaw, pitch, roll)
-
Set the values of this matrix from the given
yaw
,pitch
androll
values.Parameters:
Name Type Description yaw
number The yaw value.
pitch
number The pitch value.
roll
number The roll value.
- Since: 3.0.0
- Source: src/math/Matrix4.js (Line 1353)
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 151)
Returns:
This Matrix4.
- Type
- Phaser.Math.Matrix4