0
\$\begingroup\$

I'm currently working on quaternion rotation and I have them working, but it seems to be using the world XYZ axis to rotate around, which is an issue as the camera rotates itself around an axis.

enter image description here

Similar to the last image, how do I rotate the camera around its local XYZ axis rather than the world XYZ?

Edit:

The camera now rotates around its local axis, but when doing so, it does not change its values in world space. I can hold a key down and it will rotate around the correct axis, but once I release the key it will snap back to its original position before the rotation began. What must I do to allow the local changes to be applied to world space?

\$\endgroup\$
2
  • \$\begingroup\$ Rotate the camera before translating it. \$\endgroup\$
    – Bálint
    Feb 2, 2017 at 19:12
  • \$\begingroup\$ I post that as an answer \$\endgroup\$
    – Bálint
    Feb 2, 2017 at 20:05

1 Answer 1

1
\$\begingroup\$

To rotate something around it's local X, Y and Z axes instead of around the global axes you need to rotate it first and then translate it.

\$\endgroup\$
1
  • \$\begingroup\$ There is another problem with this. When I'm rotating in local space, the object doesn't update its lookat coordinates. The camera rotates around the correct axis, but when I stop rotating, it snaps back to its original position. What must I do to make it update its local values to world values? \$\endgroup\$
    – user
    Feb 3, 2017 at 18:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .