c++ - Camera is tilting when trying to rotate quaternion - Stack Overflow
I'm trying to write a simple camera controller for my c++ project that uses glm and quaternions. The thing is that the camera keeps tilting after a little bit of looking around. Here is an image
And here is the code for the camera rotating:
if (MouseOffset.x)
{
m_Parent->Transform.Rotation = glm::normalize(m_Parent->Transform.Rotation * glm::angleAxis(MouseOffset.x * m_Sensitivity * static_cast<float>(DeltaTime), YAxis));
}
if (MouseOffset.y)
{
m_Parent->Transform.Rotation = glm::normalize(m_Parent->Transform.Rotation * glm::angleAxis(MouseOffset.y * m_Sensitivity * static_cast<float>(DeltaTime), XAxis));
}
最新文章
- 虚拟现实究竟离现实还有多远?
- 软硬件一体化模式席卷IT业:厂商策略各有不同
- 常受电脑辐射的白领男易生闺女?
- typescript - Npm 404 Not found - Stack Overflow
- I need help importing my global.css file in next.js - Stack Overflow
- linux - Zowe Config Error popping up on VSCODE? How may I fix this error? - Stack Overflow
- AWS CloudFront occasionally does not send request to custom origin server - Stack Overflow
- ios - AccessorySetupKit picker doesn't show accessory unless previously paired in Setting app first - Stack Overflow
- javascript - How to delete content from content-editable field on facebookmessenger.com? - Stack Overflow
- macos - Can't access UI "section" in AppleScript - Stack Overflow
- react native - Top SafeArea on iOS cannot be ignored - Stack Overflow
- smartcontracts - FailedCall() with OpenZeppelin meta transactions (ERC2771Forwarder and ERC2771Context) - Stack Overflow
- python - Pandas DataFrame not populating as expected from JSON data produced by OpenAI API - Stack Overflow
- google apps script - How do I correct my code to move a row from one tab to another tab in Sheets, and then delete it from the s
- augmented reality - Applying 2d image to a 3d object in xcode tutorials? - Stack Overflow
- javascript - <function name> error: FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been
- c++20 - Why can't C++ tell return_void and return_value are mutually exclusive? - Stack Overflow