Skip to main content

Quaternion

class Quaternion

Quaternion is used to represent 3D rotations.


public class Quaternion

β€” Constructors (2) β€”

ConstructorDescription
Quaternion()Creates a new Quaternion with all values setted as 0.
Quaternion(float w, float x, float y, float z)Creates a new Quaternion with W, X, Y and Z setted as "w", "x" , "y" and "z" arguments respectively.

β€” Methods (53) β€”

NameDescription
float getX()Return the current X value inside of this vector.
float getY()Return the current Y value inside of this vector.
float getZ()Return the current Z value inside of this vector.
float getQX()Return the current QX value inside of this vector.
float getQY()Return the current QY value inside of this vector.
float getQZ()Return the current QZ value inside of this vector.
float getQW()Return the current QW value inside of this vector.
void setX(float value)Sets the current X value inside of this vector with a new value.
void setY(float value)Sets the current Y value inside of this vector with a new value.
void setZ(float value)Sets the current Z value inside of this vector with a new value.
void setQX(float value)Sets the current QX value inside of this vector with a new value.
void setQY(float value)Sets the current QY value inside of this vector with a new value.
void setQZ(float value)Sets the current QZ value inside of this vector with a new value.
void setQW(float value)Sets the current QW value inside of this vector with a new value.
void set(Quaternion value)Sets the current value within this quaternion with a new quaternion of the argument.
void set(float a)Sets the current value within this quaternion to a new value.
void set(float w, float x, float y, float z)Sets the current W, X, Y and Z value within this quaternion to a new value.
Quaternion mul(Quaternion value)Multiplies the current quaternion values with the input quaternion values and return a new instance with these multiplied values.
Quaternion mul(float w, float x, float y, float z)Multiplies the current quaternion values with the input W, X, Y and Z values and return a new instance with these multiplied values.
void mulLocal(Quaternion value)Multiply the current values of the quaternion by the values of the input quaternion and apply to the quaternion itself.
void mulLocal(float w, float x, float y, float z)Multiply the current values of the quaternion by the input values W, X , Y and Z and apply to the quaternion itself.
Quaternion normalize()Makes the quaternion have a magnitude of 1, the quaternion keeps the same direction but its length is 1.0, if the quaternion is too small to normalize, it is set to zero.
void normalizeLocal()Makes the quaternion have magnitude 1, the quaternion keeps the same direction, but its length is 1.0, the difference to "normalize" is that this method applies the modification to the quaternion itself, if the vector is too small to normalize , is set to zero.
boolean equals(Quaternion value)Compares the first quaternion with the one in the argument, returns true if the values match.
boolean equals(float a)Compares first quaternion with argument value, returns true if values match.
boolean equals(float w, float x, float y, float z)Compares the quaternion with the value of the arguments respectively W, X, Y and Z, returns true if the values match.
void blend(Quaternion value, float blend)Mix the Quaternion with another to be "value" and "blend arguments, and apply to the Quaternion itself.
void selfLookTo(Vector3 to)Sets the Quaternion's rotation in a way to point the object to the position passed to be "to" argument.
void selfLookTo(Vector3 from, Vector3 to)Sets the Quaternion's rotation to be "from" argument in a way to point the object to the position passed to be "to" argument.
void localLookTo(Vector3 to)Sets the Quaternion's rotation in a way to point the object to the position passed to be "to" argument and apply to the Quaternion itself.
void localLookTo(Vector3 from, Vector3 to)Sets the Quaternion's rotation to be "from" argument in a way to point the object to the position passed to be "to" argument and apply to Quaternion itself.
void lookTo(Vector3 to)Sets the Quaternion's rotation in a way to point the object to the position passed to be "to" argument.
void lookTo(Vector3 from, Vector3 to)Sets the Quaternion's rotation to be "from" argument in a way to point the object to the position passed to be "to" argument.
void lookTo(Vector3 from, Vector3 to, Vector3 up)Sets the Quaternion's rotation to be "from" argument in a way to point the object to the position passed to be "to" argument and pointing up from the position passed to be "up" argument.
Quaternion slerp(Quaternion value, float speed)Creates a rotation that smoothly interpolates between the Quaternion and Quaternion of the "value" argument, based on a speed, which is represented by the value of the "speed" argument.
void slerpLocal(Quaternion value, float speed)Creates a rotation that smoothly interpolates between the Quaternion and the Quaternion of the "value" argument, based on a speed, which is represented by the value of the "speed" argument, and applies to the Quaternion itself.
void slerpLocal(Quaternion a, Quaternion b, float speed)Creates a rotation that smoothly interpolates between the first Quaternion to be "a" argument and the second Quaternion to be "b" argument, based on a speed, which is represented by the value of the "speed" argument, and applies to the Quaternion itself.
void setIdentity()Resets Quaternion values to default.
void setFromEuler(Vector3 value)Sets Quaternion rotation using Euler angles.
void setFromEuler(float x, float y, float z)Sets Quaternion rotation using Euler angles respectively to be "x", "y" and "z" arguments.
Quaternion copy()returns the perfect copy of a Quaternion.
Vector3 rotateVector(Vector3 value)Rotates the vector of the "value" argument using Quaternion rotation, and returns a new vector with the result.
Vector3 rotateVector(Vector3 value, Vector3 out)Rotate the "value" argument vector using Quaternion rotation, and apply the result to the "out" argument vector.
Quaternion fromEuler(Vector3 value)Creates a new quaternion using the euler rotation passed to be "value" argument, and returns a new Quaternion with the result.
Quaternion createFromEuler(Vector3 value)Creates a new Quaternion using the euler rotation passed to be "value" argument, and returns a new quaternion with the result.
Quaternion createFromEuler(float x, float y, float z)Creates a new Quaternion using the euler rotation passed to be arguments, respectively "x", "y" and "z", and returns a new Quaternion with the result.
Quaternion zero()returns a new Quaternion with its axes at 0.
Quaternion blendOut(Quaternion a, Quaternion b, float blend)Mixes the Quaternion with another and returns the result in a new Quaternion.
Quaternion slerp(Quaternion a, Quaternion b, float speed)Creates a rotation that smoothly interpolates between the first Quaternion to be "a" argument and the second Quaternion to be "b" argument, based on a velocity, which is represented by the value of the "t" argument.
Quaternion lookAt(Vector3 from, Vector3 to)Sets the Quaternion's rotation to be "from" argument in a way to point the object to the position passed to be "to" argument and returns the result in a new Quaternion.
Quaternion lookAt(Vector3 from, Vector3 to, Vector3 up)Sets the Quaternion's rotation to be "from" argument in a way to point the object to the position passed to be "to" argument and pointing up from the position passed to be "up" argument, and returns the result in a new Quaternion.
Quaternion angleAxis(float angle, Vector3 value)Sets this Quaternion to the values specified by an angle and an axis of rotation.
Quaternion angleAxis(float angle, float x, float y, float z)Sets this Quaternion to the values specified by an angle and an axis of rotation.

β€” Operators (2) β€”

* Multiply 2 quaternions The multiplication of quaternions results in the sum of their angles of rotation.


*= Multiply 2 Quaternions The multiplication of quaternions results in the sum of their rotation angles and applies the result to the Quaternion itself.


β€” Comparators (1) β€”

== Compares if the 4 axes of Quaternion are equal.