Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Basis must be normalized in order to be caster to a Quaternion... #30

Open
ghost opened this issue Mar 15, 2023 · 1 comment
Open
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Mar 15, 2023

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()
smoothing.gd:201 @ _process()

and the rotation get stuck until project close

@lawnjelly
Copy link
Owner

lawnjelly commented Mar 15, 2023

Good spot I'll try and fix this after the weekend. 👍

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...

@lawnjelly lawnjelly added the bug Something isn't working label Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant