godot-docs
godot-docs copied to clipboard
using transform.basis.orthonormalized() instead of transform.basis wh…
…en creating Quaternion
In the Interpolating with quaternions section, add the .orthonormalized() function to the creation of the Quaternion. While Quaternion(Basis) usually works fine, it fails when the basis is not orthonormalized, as stated in the Quaternion documentation (see below) :
Quaternion Quaternion(from: Basis)
Constructs a Quaternion from the given rotation Basis.
This constructor is faster than Basis.get_rotation_quaternion(), but the given basis must be orthonormalized (see Basis.orthonormalized()). Otherwise, the constructor fails and returns IDENTITY.