TheCherno / Sparky

Cross-Platform High Performance 2D/3D game engine for people like me who like to write code.
Apache License 2.0
1.1k stars 221 forks source link

3D mouse rotation fix #75

Closed AlexVasiluta closed 8 years ago

AlexVasiluta commented 8 years ago

If you rotate the camera at 90 degrees or -90 degrees you will flip side upside down, so I fixed it in the FPSCamera.cpp file. it looked like this: if (m_MouseWasGrabbed) { m_Yaw += mouse.x * m_MouseSensitivity; m_Pitch += mouse.y * m_MouseSensitivity; } so I changed it to this: if (m_MouseWasGrabbed) { m_Yaw += mouse.x * m_MouseSensitivity; m_Pitch += mouse.y * m_MouseSensitivity; if (m_Pitch < -1.5f) m_Pitch = -1.5f; if (m_Pitch > 1.75f) m_Pitch = 1.75f; }