CedricGuillemet / ImGuizmo

Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui
MIT License
3.22k stars 907 forks source link

Manipulate not working #324

Closed Aleix20 closed 8 months ago

Aleix20 commented 8 months ago

I'm trying to adapt ImGuizmo with Qt. It seems that ImGuizmo's manipulation interaction works fine; the rotation axis moves well, but my model is not changing.

if (mSelectedItem) {

glm::mat4 projectionMatrix = mCamera->GetProjectionMatrix();
glm::mat4& modelMatrix = mSelectedItem->GetModelMatrix(); // Replace with your model matrix

// Set ImGuizmo operation (TRANSLATE, ROTATE, SCALE)
ImGuizmo::OPERATION operation = ImGuizmo::ROTATE;

// Set ImGuizmo mode (LOCAL, WORLD)
ImGuizmo::MODE mode = ImGuizmo::LOCAL;

// Render ImGuizmo gizmo
ImGuizmo::Manipulate(
    glm::value_ptr(viewMatrix),
    glm::value_ptr(projectionMatrix),
    operation,
    mode,
    glm::value_ptr(modelMatrix)
);

}

I'm attempting to edit the model, but the axis is consistently drawn in the middle of my grid, and the model doesn't seem to change.

I'm using this as an 'adapter' to Qt: https://github.com/seanchas116/qtimgui/blob/master/examples/widget/demo-widget.cpp. Also, the issue is occurring with the manipulate view. Any help is appreciated to adapt this to my Qt project.

image