1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 03:23:54 +00:00

Fix camera shaking when near the pitch limit.

This commit is contained in:
scrawl 2013-04-07 15:52:43 +02:00
parent ff1d908af4
commit 755a80a522

View file

@ -242,14 +242,15 @@ namespace MWRender
void Player::setPitch(float angle) void Player::setPitch(float angle)
{ {
float limit = Ogre::Math::HALF_PI; const float epsilon = 0.000001;
float limit = Ogre::Math::HALF_PI - epsilon;
if (mVanity.forced || mPreviewMode) { if (mVanity.forced || mPreviewMode) {
limit /= 2; limit /= 2;
} }
if (angle > limit) { if (angle > limit) {
angle = limit - 0.01; angle = limit;
} else if (angle < -limit) { } else if (angle < -limit) {
angle = -limit + 0.01; angle = -limit;
} }
if (mVanity.enabled || mPreviewMode) { if (mVanity.enabled || mPreviewMode) {
mPreviewCam.pitch = angle; mPreviewCam.pitch = angle;