CedricGuillemet / ImGuizmo

Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with Rotation Gizmos and my Engine

Ayan-Banerjee-918 opened this issue · comments

First of all, thank you for putting the time and effort to create this wonderful gizmo setup for us.

I am creating an engine where i have my transform rotation component in degrees. I am using the following piece of code for setting up my gizmo. The problem is that in my engine whenever i click on the rotation gizmo, the object starts rotating in all 3 axes randomly and I am unable to figure out why. I would appreciate if you could point me out regarding how to fix this.

Attached a screen record for better understanding of my issue.

Screenshot 2021-10-09 231957

Screenshot 2021-10-09 231511

Error.mp4

Instead of computing a delta that get accumulated, what happens when you set the Euler angles to the transform?

this->transformComponent.rotation = rotation;

If I do that,then what happens is the rotation goes from -3 to +3 and back which is because it's in radians.The object then also responds to -3 to +3 rotation only bcoz it's interpreting the radians as degrees. Now if I try to convert the rotation to degrees using glm::degrees then again the same thing starts happening as shown above.

can you please open a branch that repros the issue?

Am pretty new to GitHub, so should I upload the engine code to my repository , then tell you where the relevant code is so that you can find it?

Or am I misinterpreting what you are asking me to do ?

Edit: Doing this this->transformComponent.rotation = rotation; has no effect ,same thing is happening,and no matter which axis I select it starts rotating randomly in all 3 axes

Usually, people take the sample and tweak it so their issue appears. Then upload the branch on their repo.

@CedricGuillemet after lots of tweaking over the past couple of days, I have managed to fix the problem, but it has given rise to a very small problem , which I think you might be able to help :) .

I will show you the screengrab the issue is pretty much self explanatory. I want to know how to avoid the change of values in the axes other than the one I am rotating.

Also note that when I am rotating the Z axes, then X and Y values are not changing but for X and Y, all are changing.

In the attached video, check the rotation component's X,Y and Z values.

As for others, who face similar issues, here is how I fixed it:

[Check the code at the top of this thread vs now]
Solution

bug.mp4

.

It looks like you are rotating in world space while there is already a small orientation in local space.

Yes you are right,thanks! Fixed :)

Hello , sorry to bother you , I see that you are using the imgui docking branch and you are using the gizmos, can you share how you added the gizmos to the window ? I am having some problems with the docked window, all gizmos are overdrawn.