Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Stacktrace
- ------------------
- 00000000()
- OgreMain.dll!77871273()
- [Unten angegebene Rahmen sind möglicherweise nicht korrekt und/oder fehlen, keine Symbole geladen für OgreMain.dll]
- OgreMain.dll!777f4584()
- OgreMain.dll!77872f2a()
- OgreMain.dll!77872767()
- > sumwars.exe!DebugCameraTab::update(OIS::Keyboard * keyboard, OIS::Mouse * mouse) Zeile 183 C++
- sumwars.exe!DebugPanel::update(OIS::Keyboard * keyboard, OIS::Mouse * mouse) Zeile 113 + 0x8 Bytes C++
- sumwars.exe!MainWindow::update(float time) Zeile 672 + 0x39 Bytes C++
- sumwars.exe!Application::run() Zeile 342 C++
- sumwars.exe!main(int argc, char * * argv) Zeile 71 C++
- sumwars.exe!__tmainCRTStartup() Zeile 555 + 0x17 Bytes C
- kernel32.dll!7578d309()
- ntdll.dll!76f016c3()
- ntdll.dll!76f01696()
- Code
- ----------------
- Ogre::Radian rotX = Ogre::Radian();
- Ogre::Radian rotY = Ogre::Radian();
- Ogre::Vector3 vec = Ogre::Vector3();
- if ( m_leftMouseDown )
- {
- rotX = Ogre::Radian ( mouse->getMouseState().X.rel * 0.05f );
- rotY = Ogre::Radian ( mouse->getMouseState().Y.rel * 0.05f );
- }
- else if ( m_rightMouseDown )
- vec = Ogre::Vector3 ( 0.0f, 0.0f, mouse->getMouseState().Y.rel * 5 );
- if ( m_leftMouseDown || m_rightMouseDown )
- {
- Ogre::Real pitchAngle;
- Ogre::Real pitchAngleSign;
- // Yaws the camera according to the mouse relative movement.
- this->cameraYawNode->yaw ( rotX );
- // Pitches the camera according to the mouse relative movement.
- this->cameraPitchNode->pitch ( rotY );
- // Translates the camera according to the translate vector which is
- // controlled by the keyboard arrows.
- //
- // NOTE: We multiply the mTranslateVector by the cameraPitchNode's
- // orientation quaternion and the cameraYawNode's orientation
- // quaternion to translate the camera accoding to the camera's
- // orientation around the Y-axis and the X-axis.
- Ogre::Quaternion q1 = this->cameraYawNode->getOrientation();
- Ogre::Quaternion q2 = this->cameraPitchNode->getOrientation();
- //Ogre::Vector3 trvec = this->cameraYawNode->getOrientation() * this->cameraPitchNode->getOrientation() * vec;
- Ogre::Quaternion q3 = q1 * q2;
- Ogre::Vector3 trvec = q3 * vec;
- this->cameraNode->translate ( trvec, Ogre::SceneNode::TS_LOCAL );
- // Angle of rotation around the X-axis.
- pitchAngle = ( 2 * Ogre::Degree ( Ogre::Math::ACos ( q2.w ) ).valueDegrees() );
- // Just to determine the sign of the angle we pick up above, the
- // value itself does not interest us.
- pitchAngleSign = q2.x;
- // Limit the pitch between -90 degress and +90 degrees, Quake3-style.
- if ( pitchAngle > 90.0f )
- {
- if ( pitchAngleSign > 0 )
- // Set orientation to 90 degrees on X-axis.
- this->cameraPitchNode->setOrientation ( Ogre::Quaternion ( Ogre::Math::Sqrt ( 0.5f ),
- Ogre::Math::Sqrt ( 0.5f ), 0, 0 ) );
- else if ( pitchAngleSign < 0 )
- // Sets orientation to -90 degrees on X-axis.
- this->cameraPitchNode->setOrientation ( Ogre::Quaternion ( Ogre::Math::Sqrt ( 0.5f ),
- -Ogre::Math::Sqrt ( 0.5f ), 0, 0 ) );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement