ImGuizmo icon indicating copy to clipboard operation
ImGuizmo copied to clipboard

Problem with Rotation Gizmos and my Engine

Open Ayan-Banerjee-918 opened this issue 3 years ago • 10 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

https://user-images.githubusercontent.com/19729019/136669202-cd491a71-d95e-47c3-9029-76dab4fa88ee.mp4

Ayan-Banerjee-918 avatar Oct 09 '21 17:10 Ayan-Banerjee-918

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

this->transformComponent.rotation = rotation;

CedricGuillemet avatar Oct 11 '21 07:10 CedricGuillemet

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.

Ayan-Banerjee-918 avatar Oct 11 '21 07:10 Ayan-Banerjee-918

can you please open a branch that repros the issue?

CedricGuillemet avatar Oct 11 '21 07:10 CedricGuillemet

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 ?

Ayan-Banerjee-918 avatar Oct 11 '21 07:10 Ayan-Banerjee-918

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

Ayan-Banerjee-918 avatar Oct 11 '21 08:10 Ayan-Banerjee-918

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

CedricGuillemet avatar Oct 11 '21 09:10 CedricGuillemet

@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

https://user-images.githubusercontent.com/19729019/137351103-cbfd6b1d-7f3a-4aae-b1a8-9e98e897d5a3.mp4

.

Ayan-Banerjee-918 avatar Oct 14 '21 15:10 Ayan-Banerjee-918

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

CedricGuillemet avatar Oct 16 '21 14:10 CedricGuillemet

Yes you are right,thanks! Fixed :)

Ayan-Banerjee-918 avatar Oct 16 '21 15:10 Ayan-Banerjee-918

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.

v71 avatar Apr 07 '24 22:04 v71