new Quaternion([x], [y], [z], [w])
name | type | arguments | Default | description |
---|---|---|---|---|
x | number | <optional> | 0 |
The x component. |
y | number | <optional> | 0 |
The y component. |
z | number | <optional> | 0 |
The z component. |
w | number | <optional> | 1 |
The w component. |
This callback is invoked, if set, each time a value in this quaternion is changed. The callback is passed one argument, a reference to this quaternion.
The w component of this Quaternion.
The x component of this Quaternion.
The y component of this Quaternion.
The z component of this Quaternion.
Add a given Quaternion or Vector to this Quaternion. Addition is component-wise.
name | type | description |
---|---|---|
v | Phaser.Math.Quaternion | Phaser.Math.Vector4 |
The Quaternion or Vector to add to this Quaternion. |
This Quaternion.
Create a unit (or rotation) Quaternion from its x, y, and z components.
Sets the w component.
This Quaternion.
Convert this Quaternion into its conjugate.
Sets the x, y and z components.
This Quaternion.
Copy the components of a given Quaternion or Vector into this Quaternion.
name | type | description |
---|---|---|
src | Phaser.Math.Quaternion | Phaser.Math.Vector4 |
The Quaternion or Vector to copy the components from. |
This Quaternion.
Calculate the dot product of this Quaternion and the given Quaternion or Vector.
name | type | description |
---|---|---|
v | Phaser.Math.Quaternion | Phaser.Math.Vector4 |
The Quaternion or Vector to dot product with this Quaternion. |
The dot product of this Quaternion and the given Quaternion or Vector.
Convert the given Matrix into this Quaternion.
name | type | description |
---|---|---|
mat | Phaser.Math.Matrix3 |
The Matrix to convert from. |
This Quaternion.
Reset this Matrix to an identity (default) Quaternion.
This Quaternion.
Invert this Quaternion.
This Quaternion.
Calculate the length of this Quaternion.
The length of this Quaternion.
Calculate the length of this Quaternion squared.
The length of this Quaternion, squared.
Linearly interpolate this Quaternion towards the given Quaternion or Vector.
name | type | arguments | description |
---|---|---|---|
v | Phaser.Math.Quaternion | Phaser.Math.Vector4 |
The Quaternion or Vector to interpolate towards. |
|
t | number | <optional> |
The percentage of interpolation. |
This Quaternion.
Multiply this Quaternion by the given Quaternion or Vector.
name | type | description |
---|---|---|
b | Phaser.Math.Quaternion | Phaser.Math.Vector4 |
The Quaternion or Vector to multiply this Quaternion by. |
This Quaternion.
Normalize this Quaternion.
This Quaternion.
Rotate this Quaternion on the X axis.
name | type | description |
---|---|---|
rad | number |
The rotation angle in radians. |
This Quaternion.
Rotate this Quaternion on the Y axis.
name | type | description |
---|---|---|
rad | number |
The rotation angle in radians. |
This Quaternion.
Rotate this Quaternion on the Z axis.
name | type | description |
---|---|---|
rad | number |
The rotation angle in radians. |
This Quaternion.
Rotates this Quaternion based on the two given vectors.
name | type | description |
---|---|---|
a | Phaser.Math.Vector3 |
The transform rotation vector. |
b | Phaser.Math.Vector3 |
The target rotation vector. |
This Quaternion.
Scale this Quaternion by the given value.
name | type | description |
---|---|---|
scale | number |
The value to scale this Quaternion by. |
This Quaternion.
Set the components of this Quaternion and optionally call the onChangeCallback
.
name | type | arguments | Default | description |
---|---|---|---|---|
x | number | object | <optional> | 0 |
The x component, or an object containing x, y, z, and w components. |
y | number | <optional> | 0 |
The y component. |
z | number | <optional> | 0 |
The z component. |
w | number | <optional> | 0 |
The w component. |
update | boolean | <optional> | true |
Call the |
This Quaternion.
Set the axes of this Quaternion.
name | type | description |
---|---|---|
view | Phaser.Math.Vector3 |
The view axis. |
right | Phaser.Math.Vector3 |
The right axis. |
up | Phaser.Math.Vector3 |
The upwards axis. |
This Quaternion.
Set the axis angle of this Quaternion.
name | type | description |
---|---|---|
axis | Phaser.Math.Vector3 |
The axis. |
rad | number |
The angle in radians. |
This Quaternion.
Set this Quaternion from the given Euler, based on Euler order.
name | type | arguments | Default | description |
---|---|---|---|---|
euler | Phaser.Math.Euler |
The Euler to convert from. |
||
update | boolean | <optional> | true |
Run the |
This Quaternion.
Sets the rotation of this Quaternion from the given Matrix4.
name | type | description |
---|---|---|
mat4 | Phaser.Math.Matrix4 |
The Matrix4 to set the rotation from. |
This Quaternion.
Smoothly linearly interpolate this Quaternion towards the given Quaternion or Vector.
name | type | description |
---|---|---|
b | Phaser.Math.Quaternion | Phaser.Math.Vector4 |
The Quaternion or Vector to interpolate towards. |
t | number |
The percentage of interpolation. |
This Quaternion.
Subtract a given Quaternion or Vector from this Quaternion. Subtraction is component-wise.
name | type | description |
---|---|---|
v | Phaser.Math.Quaternion | Phaser.Math.Vector4 |
The Quaternion or Vector to subtract from this Quaternion. |
This Quaternion.