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

Basis.toAxisAngle return NaN as angle #63397

Closed
fabriceci opened this issue Jul 24, 2022 · 3 comments · Fixed by #63428
Closed

Basis.toAxisAngle return NaN as angle #63397

fabriceci opened this issue Jul 24, 2022 · 3 comments · Fixed by #63428
Assignees
Milestone

Comments

@fabriceci
Copy link
Contributor

Godot version

4.0.dev #b3df275

System information

MacOS 11.6

Issue description

When the rotation angle is very small, the angle returned is NaN.

Steps to reproduce

In c++:

Basis bugNan(1.00000024, 0 , 0.000100001693, 0, 1, 0, -0.000100009143, 0, 1.00000024);
bugNan.get_axis_angle(axis, angle);
print_line(angle) // NaN

Minimal reproduction project

No response

@fabriceci fabriceci added this to the 4.0 milestone Jul 24, 2022
@fabriceci fabriceci self-assigned this Jul 24, 2022
@fire
Copy link
Member

fire commented Jul 24, 2022

@TokageItLab did the quaternion version of this.

@TokageItLab
Copy link
Member

TokageItLab commented Jul 24, 2022

Yeah I recall that I did some changes such as to return an initial Quaternion Quaternion(0, 0, 0, 1) when AxisAngle is very small in Quaternion::exp() and add angle checking Quaternion::get_axis() in #57675. I guess that some math checking is lacking in Basis.

@fabriceci
Copy link
Contributor Author

I found the issue in Basis, I will open a PR. The arcos() function receive a value greater than one, so it returns NaN, I clamped the value to avoid the issue. I was wondering if we could put a debug code to find this kind of problem for arcos/arcsin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants