Closed FSY1901 closed 2 years ago
Where is your window positioned and what's the size you set? Perhaps the size is too small? If you haven't created a window at all, the gizmo should be rendered in a debug window. Also try to set ImGuizmo::SetOrthographic(true)
to true and see if it's there.
When I set it to Orthographic, they show up, but not at the right place. So I assume my Matrices aren't correct. Dyou have any idea what could be wrong?
Ok, so I got them on the screen now, but I can't use them. Here's the code:
if (selectedObject != nullptr) {
ImGuizmo::SetOrthographic(true);
ImGuizmo::SetDrawlist();
ImGuizmo::SetRect(ImGui::GetWindowPos().x, ImGui::GetWindowPos().y, ImGui::GetWindowWidth(), ImGui::GetWindowHeight());
glm::mat4 viewMat = glm::inverse(m_sceneCamera.GetTransformationMatrix());
glm::mat4 transform = selectedObject->GetTransformationMatrix();
ImGuizmo::Manipulate(glm::value_ptr(viewMat), glm::value_ptr(projection*view), ImGuizmo::OPERATION::TRANSLATE, ImGuizmo::MODE::WORLD, glm::value_ptr(transform));
}
Uhhhh, my mistake. I can actually use them, I just had to add this code:
if (ImGuizmo::IsUsing()) {
glm::vec3 pos = glm::vec3(transform[3]);
selectedObject->position.x = pos.x;
selectedObject->position.y = pos.y;
selectedObject->position.z = pos.z;
}
Thanks @neo-mashiro for helping me!
I wanted to implement Imguizmo in on of my projects and for this I followed this video: https://www.youtube.com/watch?v=Pegb5CZuibU&t=736s But I don't see any guizmos. Here is the code that I wrote:
'projection' is calculated like this:
What do I need to change in my code for it to work?