W3cubDocs

/Godot 3.0

Quat

Category: Built-In Types

Brief Description

Quaternion.

Member Functions

Quat Quat ( float x, float y, float z, float w )
Quat Quat ( Vector3 axis, float angle )
Quat Quat ( Basis from )
Quat cubic_slerp ( Quat b, Quat pre_a, Quat post_b, float t )
float dot ( Quat b )
Quat inverse ( )
bool is_normalized ( )
float length ( )
float length_squared ( )
Quat normalized ( )
Quat slerp ( Quat b, float t )
Quat slerpni ( Quat b, float t )
Vector3 xform ( Vector3 v )

Member Variables

  • float w - W component of the quaternion. Default value: 1
  • float x - X component of the quaternion. Default value: 0
  • float y - Y component of the quaternion. Default value: 0
  • float z - Z component of the quaternion. Default value: 0

Description

A 4-dimensional vector representing a rotation.

The vector represents a 4 dimensional complex number where multiplication of the basis elements is not commutative (multiplying i with j gives a different result than multiplying j with i).

Multiplying quaternions reproduces rotation sequences. However quaternions need to be often renormalized, or else they suffer from precision issues.

It can be used to perform SLERP (spherical-linear interpolation) between two rotations.

Member Function Description

Quat Quat ( float x, float y, float z, float w )

Returns a quaternion defined by these values.

Quat Quat ( Vector3 axis, float angle )

Returns a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.

Quat Quat ( Basis from )

Returns the rotation matrix corresponding to the given quaternion.

Quat cubic_slerp ( Quat b, Quat pre_a, Quat post_b, float t )

Performs a cubic spherical-linear interpolation with another quaternion.

float dot ( Quat b )

Returns the dot product of two quaternions.

Quat inverse ( )

Returns the inverse of the quaternion.

bool is_normalized ( )

Returns whether the quaternion is normalized or not.

float length ( )

Returns the length of the quaternion.

float length_squared ( )

Returns the length of the quaternion, squared.

Quat normalized ( )

Returns a copy of the quaternion, normalized to unit length.

Quat slerp ( Quat b, float t )

Performs a spherical-linear interpolation with another quaternion.

Quat slerpni ( Quat b, float t )

Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°.

Vector3 xform ( Vector3 v )

Transforms the vector v by this quaternion.

© 2014–2018 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
http://docs.godotengine.org/en/3.0/classes/class_quat.html