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

Incorrect quaternion multipliciation? #112

Closed
perkele1989 opened this issue Oct 1, 2023 · 1 comment
Closed

Incorrect quaternion multipliciation? #112

perkele1989 opened this issue Oct 1, 2023 · 1 comment

Comments

@perkele1989
Copy link
Contributor

Compare the two lines of code below. The first one is from Transform::SetRotation, and the second one is from Transform::Rotate.

The first one seem to work how I expect quaternion multiplication to work. I.e. inverse multiplication, or childRotation * parentRotation to have the parent rotation applied first. From what I can tell, the second one seems to flip this concept though, and applies the rotation delta before it applies the current rotation. Is this a bug or am I just a bit slow today?

SetRotationLocal(!HasParent() ? rotation : rotation * GetParent()->GetRotation().Inverse());

        SetRotationLocal(!HasParent() ? rotation : rotation * GetParent()->GetRotation().Inverse());

SetRotationLocal((m_rotation_local * delta).Normalized());

            SetRotationLocal((m_rotation_local * delta).Normalized());
@PanosK92
Copy link
Owner

PanosK92 commented Oct 2, 2023

You are correct, thank you for taking the time to bring this to my attention 👍🏻

This commit fixes it

@PanosK92 PanosK92 closed this as completed Oct 2, 2023
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

No branches or pull requests

2 participants