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

Editor: rotation #515

Merged
merged 4 commits into from
Jul 19, 2024
Merged

Conversation

Nico8340
Copy link
Contributor

@Nico8340 Nico8340 commented Jul 12, 2024

Description

This pull request improves the logic of converting from quaternion to Euler, thus eliminating previously discovered rotation issues.
Thus fixes #496

Explanation

The issue originates from the logic of the getEulerFromQuat function, which was fixed by handling euler singularities.
The function has been refactored above for easier readability.

@Nico8340 Nico8340 changed the title Editor: Rotation Editor: rotation Jul 12, 2024
@Fernando-A-Rocha
Copy link
Contributor

Congrats 🎉!

@chris1384
Copy link
Contributor

It works for the most part, but the object gets flipped at -90 on Y axis if treshold returns values near -0.5.
Probably an oversight, unsure if it's a definite fix.

    elseif treshold < -0.499 then
        return {math.deg(2 * math.atan2(q1, q0)), -90, 0}

Great job anyways!!

@Nico8340
Copy link
Contributor Author

It works for the most part, but the object gets flipped at -90 on Y axis if treshold returns values near -0.5. Probably an oversight, unsure if it's a definite fix.

    elseif treshold < -0.499 then
        return {math.deg(2 * math.atan2(q1, q0)), -90, 0}

Great job anyways!!

It was done this way on purpose, to deal with problems caused by gimbal lock.
If you want, you can make a fork of my fork (pun intended) and test it yourself.

@Dutchman101 Dutchman101 merged commit 679c01b into multitheftauto:master Jul 19, 2024
1 check failed
@Nico8340 Nico8340 deleted the editor_rotation branch July 19, 2024 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rotating an object bug
4 participants