Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Quaternion

A unit quaternion used for representing 3D rotations.

Description

Quaternions are similar to Basis, which implements the matrix representation of rotations. Unlike Basis, which stores rotation, scale, and shearing, quaternions only store rotation.

Quaternions can be parametrized using both an axis-angle pair or Euler angles. Due to their compactness and the way they are stored in memory, certain operations (obtaining axis-angle and performing SLERP, in particular) are more efficient and robust against floating-point errors.

Note: Quaternions need to be normalized before being used for rotation.

Bemerkung

There are notable differences when using this API with C#. See C# API Unterschiede zu GDScript for more information.

Tutorials

Properties

float

w

1.0

float

x

0.0

float

y

0.0

float

z

0.0

Constructors

Quaternion

Quaternion ( )

Quaternion

Quaternion ( Quaternion from )

Quaternion

Quaternion ( Vector3 arc_from, Vector3 arc_to )

Quaternion

Quaternion ( Vector3 axis, float angle )

Quaternion

Quaternion ( Basis from )

Quaternion

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

Methods

float

angle_to ( Quaternion to ) const

float

dot ( Quaternion with ) const

Quaternion

exp ( ) const

Quaternion

from_euler ( Vector3 euler ) static

float

get_angle ( ) const

Vector3

get_axis ( ) const

Vector3

get_euler ( int order=2 ) const

Quaternion

inverse ( ) const

bool

is_equal_approx ( Quaternion to ) const

bool

is_finite ( )