Skip to content

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

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions