How do we rotate the camera around x axis 360 degrees, without having to flip the axis, meaning without having the strange flip after we go over +-90 degrees on x axis. Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.

Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.


C++ code:




  • $\begingroup$ I think I know what flip you're talking about. Most people just clamp it and stop the camera. You want your camera to be upside down after going over +-90 degrees? If not then there'd have to be a twist to the camera. Like once one of your spherical angles hits +-90 degrees the other angle does a 180. $\endgroup$ – Andrew Wilson Oct 14 '17 at 1:18
  • $\begingroup$ The OP is having a different problem. Their code protects the pitch from getting to high or low, but they are having problems with yaw rotation. $\endgroup$ – Alan Wolfe Oct 14 '17 at 15:39
  • 1
    $\begingroup$ @AlanWolfe I've just uploaded a video of explaining the issue. I think the yaw(rotation around y axis) works, but pitch(around x) doesn't, if I'm not mistaking. $\endgroup$ – Test Oct 14 '17 at 16:19
  • 1
    $\begingroup$ @AlanWolfe Also, sorry I think I've uploaded the wrong code on the original post, just updated it. I'm simply trying to rotate the camera around the center. Around y axis works, but around x it acts strange, and I think it's because the rotation on x axis is limited to 180 degrees and if we go over it, it probably has to rotate the y axis first and then x to achieve the desired rotation point? $\endgroup$ – Test Oct 14 '17 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.