smoothing-addon
smoothing-addon copied to clipboard
Error: Basis must be normalized in order to be caster to a Quaternion...
Line 201 in smoothing.gd, it's the rotation part. I solved the issue by adding .orthonormalized() at line 136 on the global_transform. I think the problem come from this:
Player physics process:
var lerps = Math.lerp_angles(owner.rotation.y, Vector2(direction.x, -direction.y).rotated(1.57).angle(), 5.0 * delta)
owner.rotation.y = lerps
Math.gd
func short_angle_dist(from, to):
var max_angle = PI * 2
var difference = fmod(to - from, max_angle)
return fmod(2 * difference, max_angle) - difference
func lerp_angles(from, to, weight):
return from + short_angle_dist(from, to) * weight
The full error is: E 0:00:18:0186 smoothing.gd:201 @ _process(): Basis must be normalized in order to be casted to a Quaternion. Use get_rotation_quaternion() or call orthonormalized() if the Basis contains linearly independent vectors. <C++ Error> Condition "!is_rotation()" is true. Returning: Quaternion() <C++ Source> core/math/basis.cpp:702 @ get_quaternion() <Stack Trace> smoothing.gd:201 @ _process()
and the rotation get stuck until project close
Good spot I'll try and fix this after the weekend. :+1:
This is presumably only when slerping? The basis lerping shouldn't care I suspect. If I remember right for the core physics interpolation I had to do a whole load of tests to find out whether the basis was compatible with slerping...