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

Improve rotation transformation using Quaternions #34

Closed
athanggupte opened this issue Feb 11, 2022 · 0 comments
Closed

Improve rotation transformation using Quaternions #34

athanggupte opened this issue Feb 11, 2022 · 0 comments

Comments

@athanggupte
Copy link
Owner

Currently in TransformComponent the final rotation matrix is calculated by multiplying rotation matrices with respect to each axis as seen here.

This is inefficient and also has improper rotation effect as rotation in Z axis us applied after Y axis which is after X axis.

An alternative is to convert the Euler angles to quaternion and to get the Mat4 from that.

P.S. this might not solve the axis precedence issue.

#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/quaternion.hpp>

glm::mat4 rotationMatrix = glm::toMat4(glm::quat(rotation));
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

1 participant