Topic: Camera rotation based on touch issue

Hi guys,

I'm working through the calculation to update the camera position based on touch input right now. I'm noticing that after rotating in a circle by a certain amount, the direction of the camera rotation will inverse and begin to rotate the opposite way to which you were previously rotating.

Is there a way to avoid this and simply continue the camera rotation in the same direction instead of it changing direction?

I've noticed this occurs after dragging the pointer in a circular fashion past the 90 and 270 degree points.

Thanks for the help!

Re: Camera rotation based on touch issue

Yes, using quaternions instead of eulers. Euler rotations suffer from Gimbal Lock, the problem you describe is related.

Re: Camera rotation based on touch issue

Hello.

You have a problem using "Allow Camera Control", or you are trying to create your own script?
If the problem is in "Allow Camera Control", please explain this in more detail.
If the problem is in your own script, then as Draco18s wrote, you need to use quaternions.
https://docs.unity3d.com/ScriptReferenc … rnion.html

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Camera rotation based on touch issue

Hi Alex,

My issue was with the camera control. However, I created my own script in the meantime that fixes the issue. Thanks for the support and quick replies.

Re: Camera rotation based on touch issue

Hi,

I'm having a same problem when rotating a camera using my own script.
Can you guys show an example how to deal with this problem using a quaternions.