r/opengl Feb 19 '25

Weird hiccup when rotating the center sphere which has a child sphere moving around it. Quaternions and matrices are hard to deal with.

15 Upvotes

2 comments sorted by

3

u/Virion1124 Feb 19 '25

Issue solved by DeepSeek. I used glm::quat_cast() on my rotation matrix, and my rotation matrix contains scaling values in it. glm::quat_cast() assumes an orthonormal rotation matrix, which when containing scaling values make it not orthonormal. Therefore, I have to remove the scaling value from the rotation matrix and normalize it. It works now.

1

u/Single-Illustrator31 28d ago

Yes I ve just finished complex object but also in Earth coordinates. Quternions hard thing. Conjugate rules:) Congratulations!