You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does ImGuizmo only support Euler angles? I have encountered a problem with Gimbal lock, which is causing me a headache. I hope it can support quaternions in the future.
#353
Open
bingbingmasdhg opened this issue
Dec 10, 2024
· 1 comment
Does ImGuizmo only support Euler angles? I have encountered a problem with Gimbal lock, which is causing me a headache. I hope it can support quaternions in the future.
I tried to use quaternions to complete imguizmo, but unfortunately many of its functions only support vec3 and do not have quats, such as void DecomposeMatrixToComponents (const float * matrix, float * translation, float * rotation, float * scale);
void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float scale, float matrix);
If I use the Euler angles of vec3, I will encounter a very bad Gimbal lock problem, even if I use quaternions to store rotation information, it will become abnormal when using Manipulate. I hope it can support quaternions in the future. Although it may not be intuitive, it is the most scientific approach. thank you!
glm::mat4 modelMatrix = glm::toMat4(quaternion);
glm::mat4 viewMatrix = ...; // Your view matrix
glm::mat4 projectionMatrix = ...; // Your projection matrix
//Set operation mode, such as rotation
ImGuizmo::Operation operation = ImGuizmo::OPERATION::ROTATE;
//Set modes, such as local space
ImGuizmo::Mode mode = ImGuizmo::MODE::LOCAL;
bool changed = ImGuizmo::Manipulate(viewMatrix.data(), projectionMatrix.data(), modelMatrix.data(), operation, mode);
if (changed) {
quaternion = glm::quat(modelMatrix); // Update Quaternion
}
The text was updated successfully, but these errors were encountered:
Does ImGuizmo only support Euler angles? I have encountered a problem with Gimbal lock, which is causing me a headache. I hope it can support quaternions in the future.
I tried to use quaternions to complete imguizmo, but unfortunately many of its functions only support vec3 and do not have quats, such as void DecomposeMatrixToComponents (const float * matrix, float * translation, float * rotation, float * scale);
void RecomposeMatrixFromComponents(const float *translation, const float *rotation, const float scale, float matrix);
If I use the Euler angles of vec3, I will encounter a very bad Gimbal lock problem, even if I use quaternions to store rotation information, it will become abnormal when using Manipulate. I hope it can support quaternions in the future. Although it may not be intuitive, it is the most scientific approach. thank you!
glm::mat4 modelMatrix = glm::toMat4(quaternion);
glm::mat4 viewMatrix = ...; // Your view matrix
glm::mat4 projectionMatrix = ...; // Your projection matrix
//Set operation mode, such as rotation
ImGuizmo::Operation operation = ImGuizmo::OPERATION::ROTATE;
//Set modes, such as local space
ImGuizmo::Mode mode = ImGuizmo::MODE::LOCAL;
bool changed = ImGuizmo::Manipulate(viewMatrix.data(), projectionMatrix.data(), modelMatrix.data(), operation, mode);
if (changed) {
quaternion = glm::quat(modelMatrix); // Update Quaternion
}
The text was updated successfully, but these errors were encountered: