Quaternion camera. How do I make it rotate correctly?

后端 未结 2 1745
臣服心动
臣服心动 2021-02-09 02:46

I have a 3D camera with its current rotation stored as a quaternion, and I\'m having trouble rotating it correctly. I want the camera to rotate incrementally around its local ax

2条回答
  •  爱一瞬间的悲伤
    2021-02-09 03:26

    Figured out the problem. For a mouse-controled first-person camera like the one I'm going for, I want to rotate around the local x-axis to look up and down, but the global y-axis for looking side to side.

    So this is correct for the x-axis:

    m_rot = m_rot * q;
    

    But I need to do this for the y-axis:

    m_rot = d * m_rot;
    

提交回复
热议问题